I have a form using
$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']
as an action method (I pass it some arguments on the command line). I do some input validation and if errors are found, I do a
<script language="JavaScript">
<!--
alert("<?=$msg?>");
history.back();
//-->
to display the error and reload the page.
Everything worked fine until I added sessions to the mix. Prior to adding sessions, the page reloaded and the form data previously entered remained on the form. Now that I have a session_start();, whenever the page reloads I get the following error:
"Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you.
To resubmit your information and view this Web page, click the Refresh button"
If I then Refresh, the form reloads but comes up blank. Is there a way around this? I don't mind the IE security message. I just don't want the users to have to start over from scratch if there's one small error on the form.
Attached files in php.zip:
common.php contains the error display/reload javascript
accesscontrol.php contains the access control/session info
picksheet.php contains the form that does not reload properly
Forgive the sloppy code. This is my first shot at programming in 15 years!
Eric