Sticky Forms with PHP
Ever submitted a form and not filled in all the field only to have to fill them all in again? This tutorial shows you how to keep your inputted data.
To keep the inputted data in a input field have the value call the php variable for it like this:
<?php value="<?php echo $name;?>" ?>
Here is a simple form with sticky input:
<?php <form method="post" action="<?php $_SERVER['PHP_SELF'];?>"> Name:<input type="text" name="name" value="<?php echo $name;?>"/> <input type="submit" name="submit" value="submit" /> </form> ?>
If something goes wrong and the form reloads the inputted name will still be there.
To keep inputted data in textfields you need to have the code layout slightly different like this:
<?php <textarea name="text"><?php echo $text;?></textarea> ?>
This will keep the text thats inputted into the textarea.