Complete form example

After the user clicks the submit button, to ensure that the field values are entered correctly, we insert a PHP script into the HTML input element. 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):

"> 名字: *

E-mail: *

网址:

备注:

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

PHP - Complete form example

The following is the complete PHP form verification example code:

    php.cn  

PHP 表单验证实例

* 必需字段。

"> 名字: *

E-mail: *

网址:

备注:

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

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

Principle: Embed PHP script in the input tag.
If type="text", then embed value=""
If type="radio", then embed


Continuing Learning
||
一个简易的登录表单
邮箱:
密码:
"; echo "邮箱:".$email; echo "
"; echo "密码:".$passwd; ?>
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!