back link

liunx

Guest
hi. i have a html form and when the user presses the submit button they are redirected to a new page (php). depending on whether the info was entered into the back end the new page will either say "successfully entered" or "unssuccessful". If the action has been unsuccessful there is also a link on the new page redirecting the user back to the form page. however when the user hits this button all the original values entered have disappeared. How do I get the back link to work similar to how the back option on a browser works???<!--content-->Change the design of your server side code: put form and processing code within the same file:<br />
<br />
<br />
<?php<br />
<br />
$isSubmit = array_key_exists("submit",$_POST)?true:false;<br />
<br />
if($isSubmit)<br />
{ /*get form data */<br />
$input1 = $_POST["input1"];<br />
/* and validate it */<br />
}<br />
else<br />
{ /* initialize form variables with default values */<br />
$input1 = "some text";<br />
}<br />
<br />
if($isSubmit && $hasValidated)<br />
{ /* do data logging or whatever you do with it */<br />
/* echo "thank you HTML" */<br />
}<br />
else<br />
{ if($isSubmit && !$hasValidated)<br />
{ /* echo error explanation */<br />
}<br />
/* echo form with default values*/<br />
echo "<input name=\"input1\" type=\"text\" value=\"$input1\" />";<br />
}<!--content-->I felt it would be better if i could open a new page notifying the user of the transaction outcome?<!--content-->How does it matter what user sees in the address bar <br />
:confused: :confused: <br />
If you followed the suggested logic, your Conformation can look as different as you want.<!--content-->
 
Back
Top