I've got a form page on my site that passes the contents of the form to a handling script that checks for completion of the form and that certain required items are filled out. If they're not, it displays an error message telling them that so and so item is missing, to go back and enter that information and resubmit the form. Unfortunately, for many users, when they browse back, they'll lose all the information they've entered, which is frustrating for them. I experience this in IE, but not in Firefox, but I've had reports from Firefox users that they've had this happen as well.
What I'd like to do is to open the error message results into a new browser window, leaving the form page intact (and just display the success/confirmation message there if everything is filled out).
I tried using the
target attribute in the form code, but that doesn't seem to work - it seems like the handling script is overriding that. Here's what I tried:
<form action="appscript.php" target="_blank" method="post" />
That doesn't work, the error results still open in the same window (why, I'm not sure).
In the app handling script, I'm using code like this with a series of IF condition checks to see if a form data entry is filled in (and if it's in the right format for a few items, like e-mail address):
if($FirstName == "") {<br /><br />$html = new html;<br />$html -> send_header($pagetitle,$Cat,0,$user);<br /> <br />echo <<<UBBTPRINT<br />$tbopen<br /><tr><br /><td class="tdheader"><br />Application Error! - Missing First Name<br /></td><br /></tr><br />$tbclose<br /><br />$tbopen<br /><tr><br /><td class="lighttable"><br /> <br /> <br /><b>You did not enter a first name. Please use your browser's back button and fill out all required fields.</b><br /><br /> <br /></td><br /></tr><br />$tbclose<br /><br />UBBTPRINT;<br /> $html -> send_footer(); <br />exit;}
How can I get these errors to spawn in a new window, leaving the form data alone in its original window? Alternatively, is there some way I can preserve the existing form data and return what's been filled out to the user on a "return to the application to fill in missing data" link or something? If so, well, how?