Return to Snippet

Revision: 14974
at June 18, 2009 17:32 by montanaflynn


Initial Code
<?php if(isset($_POST['FORM_INPUT_OR_TEXTAREA_NAME_GOES_HERE'])){ echo $_POST['FORM_INPUT_OR_TEXTAREA_NAME_GOES_HERE']; } ?>

SAMPLE OF A FORM INPUT:

<input name="name" size="20" value="<?php if(isset($_POST['name'])){ echo $_POST['name']; } ?>">

SAMPLE OF A FORM TEXTAREA:

<textarea name="comments" rows=5 cols=20><?php if(isset($_POST['comments'])){ echo $_POST['comments']; } ?></textarea>

Initial URL
http://www.complimedia.com/contact.php

Initial Description
This is a short and sweet snippet that will save the users form input after PHP runs validation and returns false.    Very good for User Experience!

Initial Title
Stop PHP form inputs returning empty after validation

Initial Tags
form, validation

Initial Language
PHP