PHP 5 Complete Form Example

This section tells the best way to keep the qualities in the info fields at the point when the client hits the submit button.

PHP - Keep The Values in The Form

To demonstrate the qualities in the info fields after the client hits the submit catch, we include a little PHP content inside the esteem characteristic of the accompanying information fields: name, email, and site. In the remark textarea field, we put the content between the <textarea> and </textarea> labels. The little content yields the estimation of the $name, $email, $website, and $comment variables. 

Then, we additionally need to demonstrate which radio catch that was checked. For this, we must control the checked property (not the esteem characteristic for radio buttons):

Name: <input type="text" name="name" value="<?php reverberation $name;?>">

E-mail: <input type="text" name="email" value="<?php reverberation $email;?>">

Website: <input type="text" name="website" value="<?php reverberation $website;?>">

Comment: <textarea name="comment" rows="5" cols="40"><?php reverberation $comment;?></textarea>

<input type="radio" name="gender"
<?php if (isset($gender) && $gender=="female") reverberation "checked";?>
<input type="radio" name="gender"
<?php if (isset($gender) && $gender=="male") reverberation "checked";?>

PHP - Complete Form Example

Here is the finished code for the PHP Form Validation Example:


Run model »