| 3:06 am on Feb 24, 2003 (gmt 0)|
I'm guessing you are losing the form variables when you click the link back to the form.
Can you include("index.html"); after displaying the errors on your error output page?
Make index.html - index.php and submit the form to itself for processing that way your form variables should still be intact.
| 3:37 am on Feb 24, 2003 (gmt 0)|
Thanks for your suggestions...
I tried changing index.html to index.php, but that didn't work. Shouldn't I be able to transfer variables back and forth between two separate pages?
| 3:58 am on Feb 24, 2003 (gmt 0)|
Yeah you can. But you have to use the post method if you are using the php you provided above.
If you need to use 2 pages for some reason, on your process.php( in your html output ) you need a hidden form with the variables you want to post back to the first form.
<form action="index.php" method="post">
<input type="hidden" name="fname" value="<?php $_POST['fname'];?>">
<input type="submit" name="submit" value="Return to the previous page with your value intact">
Hope this makes sense :)
By the way, instead of using the link, if you just press the back button, are the values still there?
| 4:03 am on Feb 24, 2003 (gmt 0)|
I use the same setup as keeper.
Try the following with only one file, in that case index.php
First you check if the form was submitted and legit.
for example -> check if the variable exist like : $_POST['submitted'] and the referer is index.php
if that condition is true, do your field validation and if something is wrong, reoutput the form with existing values, but if all fields are ok, output a thank you message or whatever you need (redirect, etc.)
if the condition is false, simply output an empty form.
when you output your form, you can include the following field to check the var submitted
<input type="hidden" name="submitted" value="true" />
hope that helps
[added]Keeper was faster![/added]
| 4:09 am on Feb 24, 2003 (gmt 0)|
Thanks, let me try these out see if they works.
|By the way, instead of using the link, if you just press the back button, are the values still there? |
Yes they are.
| 4:16 am on Feb 24, 2003 (gmt 0)|
Instead of having process.php providing a link back to the original form, how about having it re-create the form with the data provided so far already filled in?
That does away with having to change anything in the original form. Better yet, if they keep leaving (other) required data blank, this will continue to work.
| 6:35 am on Feb 24, 2003 (gmt 0)|
process.php will recieve all the values, but that does not mean that index.html will recieve it too, only by clicking a link on the process.php page. the link has to contain the variables in it's query string, like index.html?fname=xxxxx . then index.html will have $_REQUEST['fname'] filled with a value.
you can even turn register_globals [php.net] on and you can use $fname instead.
| 2:51 pm on Feb 24, 2003 (gmt 0)|
| 12:43 am on Feb 25, 2003 (gmt 0)|
Check out this thread:
This may help you out!