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 in-putted data.
To keep the in-putted data in a input field have the value call the php variable for it like this:
value="<?php echo $name;?>"
Here is a simple form with sticky input:
<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 in-putted name will still be there.
To keep in-putted data in textfields you need to have the code layout slightly different like this:
<textarea name="text"><?php echo $text;?></textarea>
This will keep the text that's inputted into the textarea.
For the past 12 years, I’ve been developing applications for the web using mostly PHP. I do this for a living and love what I do as every day there is something new and exciting to learn.
In my spare time, the web development community is a big part of my life. Whether managing online programming groups and blogs or attending a conference, I find keeping involved helps me stay up to date. This is also my chance to give back to the community that helped me get started, a place I am proud to be apart of.
Besides programming I love spending time with friends and family and can often be found together going out catching the latest movie, staying in playing games on the sofa or planning a trip to someplace I’ve never been before.