PHP complete form example
PHP - Ensure the input 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. 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):
PHP - Complete form example
The following is the complete PHP form validation example code:
Example
您输入的内容是:"; echo $name; echo "PHP中文网 PHP 表单验证实例
* 必需字段。
"; echo $email; echo "
"; echo $website; echo "
"; echo $comment; echo "
"; echo $gender; ?>
Running example»
The execution result in the example is similar to the following figure: