FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Remember form Data HTML





thnn
I have seen sites that when you submit a form and there is an error if you click back it will take you back to the previous page but the data on that form will be filled in already. I know that this is not PHP because I have tried it. Is there any way that I need to maybe stick in the form tags to make it remember the data?

Thanks.
Temple
Umm..Well, I'm not to sure, but on PHP using HTML forms can be done. Just make the form action as POST.

Code:

<?php
if ($_POST[form_name] = "") {
     echo "Form not correctly filled out";
}
else {
     echo "Form correctly filled out";
}


It might not seem like much, but I'm using it for my current project, and it works great. Let me know if you need more info or help.
mathiaus
I believe that the above works on a new form but going back the original form that wont. Try using a session. set on the first and continue it on to the next page. when you go back the form should be filled in as it was Very Happy
SystemWisdom
HTML can't "remember" data (unless the browser extends an elements capabilities, but then that is browser dependant), however, if you want to avoid using a server side language, you could try using cookies, mainly in javascript. It is coded client side, and rather simple to use.. I even found a quick tutorial for you with a google search on "javascript cookies" here:

http://www.webreference.com/js/column8/

Hope that helps!
Related topics
script backup database
File upload with PHP, Build an upload database for your site
Building Web Forms In Flash
HTML Tutorial.
anyone know of a good php form processer script
upload form
How to build simple PHP upload form
Not show resubmit form data
Need a Contact form from HTML/PHP
retain form data
How to achieve 2 actions on html form "submit"
Can a hijacker be a keylogger too?
upload file to server using html form and CGI C
Sending Form Data to E-mail
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.