?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?Form validation
Author:??(---.snip.net)
Date:???03-07-03 12:38

I am posting a form to another PHP module for form validation and processing. The form fields are initially filled from values in a MYSQL database. If an error is encountered in the validation, I tell the user to go back, correct the error, and try again. The problem is that when you click the browser back button to go back, all of the user's changes are gone. The user is back to the original values from the database.

Does anyone know of a way to maintain the form variables' last state when returning from validation, when the validation is performed by another PHP module? Perhaps I shouldn't go to another PHP page?

Thanks for any ideas,
Sharon

?Re: Form validation
Author:??(---.cpe.net.cable.roger)
Date:???03-08-03 06:28

the easiest way is to use the input items value attribute to reprint the value in the box...what i always do with forms is place them in a common.php file, inside a function (like show_form();

in my processing page i simply call the function to show the form
an use the value attribute to hold the values

if (len($_POST['fname'])>1){ //say name need to be at least 2 chars
$fname=$_POST['fname'];
show_form();
die;
}else{
//more code

then in the form

echo "";

and voila the name shows up unchanged...no need to have the user hit the back button

Go to Top??|??Go to Topic??|??Threaded View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??

Provided By
Phorum