0

I'm working on a contact form. I have the form being checked by a PHP script once it's submitted. If the script finds an error, it will load a new page with the error message and then redirect back to the form after 10 seconds so the user can correct the error.

The problem is that when the form reloads, it is blank.

How can I have the form reload and keep the entered data?

This is what I'm using now:

window.setTimeout("window.location = './contact.htm'", 10*1000 );

Thanks.

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by almostbob
0

I'm working on a contact form. I have the form being checked by a PHP script once it's submitted. If the script finds an error, it will load a new page with the error message and then redirect back to the form after 10 seconds so the user can correct the error.

The problem is that when the form reloads, it is blank.

How can I have the form reload and keep the entered data?

This is what I'm using now:

window.setTimeout("window.location = './contact.htm'", 10*1000 );

Thanks.

Why not just reload the same page and display the error there instead of a separate page and use PHP to set the field values instead of javascript?

0

php code for forms
the form processor can be in the form
it can post to itself, on error output html even AT the precise point in the form that the invalid information is

<?php //form processing
?> 
<!doctype><html><head><body><form action='<?php echo $_SERVER['php_self']; ?>' method='post'>
<input value='<?php echo $_post['$fieldname']; ?>' name='fieldname'><?php if isset($fieldnameerror) {echo "html error correct instructions';} ?>

crappy code but my mind works best with examples

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.