Complete form example of PHP development basic tutorial

1. PHP complete form example

This chapter will introduce how to ensure that all fields are correct before clicking the "Submit" button to submit data. enter.

2. PHP - Ensure the entered value in the form

After the user clicks the submit button, in order to ensure that the field value is entered correctly, we Insert a PHP script into the HTML input element, and name each field: name, email, and website. In the textarea field in the note, we place the script between the tags.

The PHP script output values are: $name, $email, $website, and $comment variables.

Then, we also need to check the selected radio button. For this, we must set the checked attribute (not the value attribute of the radio button):

"> 名字: *

E-mail: *

网址:

备注:

性别: value="female">女 value="male">男 *

3. PHP - Complete form example

##The complete code is as follows, you can copy it to run locally and observe the results

    PHP.com  

PHP 表单验证实例

* 必需字段。

"> 名字: *

E-mail: *

网址:

备注:

性别: value="female">女 value="male">男 *

您输入的内容是:"; echo $name; echo "
"; echo $email; echo "
"; echo $website; echo "
"; echo $comment; echo "
"; echo $gender; ?>


Continuing Learning
||
PHP.com

PHP 表单验证实例

* 必需字段。

"> 名字: *

E-mail: *

网址:

备注:

性别: value="female">女 value="male">男 *

您输入的内容是:"; echo $name; echo "
"; echo $email; echo "
"; echo $website; echo "
"; echo $comment; echo "
"; echo $gender; ?>
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!