PHP complete form example

This section shows how to retain the value in the input field after the user submits the form

PHP - Ensure the input value in the form

After the user clicks the submit button, to ensure that the field value is The input is correct. We insert the PHP script into the input element of HTML. Each field is named: 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):

">
Name:
*
< br>

E-mail:
*



URL:




Note:



Gender:
value="female">女
value="male">male
*





PHP - Complete form example

    PHP中文网(runoob.com)  

PHP 表单验证实例

* 必需字段。

"> 名字: *

E-mail: *

网址:

备注:

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

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

Program running result:

0.png



Continuing Learning
||
PHP中文网(runoob.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!