PHP Forms
Moderator: General Moderators
PHP Forms
Hi,
I am developing an application in PHP. I have a HTML form and on submitting it takes me to a PHP page. Now if I press the back button, the form values disappear. Is there anyway that I could have the form values on pressing the back button of the browser? thanks
I am developing an application in PHP. I have a HTML form and on submitting it takes me to a PHP page. Now if I press the back button, the form values disappear. Is there anyway that I could have the form values on pressing the back button of the browser? thanks
- icarpenter
- Forum Commoner
- Posts: 84
- Joined: Mon Mar 07, 2005 8:12 am
- Location: Kent, England
You could write the value into a session variable in the recieving page. ie:-
And in your first page echo the session variable. ie
Using the @ to suppress the errors you will recieve when the page is loaded the first time due to the session variable being empty..ble. ie
Using the @ to suppress the errors you will recieve when the page is loaded the first time due to the session variable being empty.. ie:-
And in your first page echo the session variable. ie
Using the @ to suppress the errors you will recieve when the page is loaded the first time due to the session variable being empty..e'];
And in your first page echo the session variable. ie
And in your first page echo the session variable. ie
Using the @ to suppress the errors you will recieve when the page is loaded the first time due to the session variable being empty..e value into a session variable in the recieving page. ie:-
And in your first page echo the session variable. ie
Using the @ to suppress the errors you will recieve when the page is loaded the first time due to the session variable being empty..ge. ie:-
And in your first page echo the session variable. ie
And in your first page echo the session variable. ie
Using the @ to suppress the errors you will recieve when the page is loaded the first time due to the session variable being empty..e value into a session variable in the recieving page. ie:-
And in your first page echo the session variable. ie
Using the @ to suppress the errors you will recieve when the page is loaded the first time due to the session variable bein1;'value'];
Using the @ to suppress the errors you will recieve when the page is loaded the first time due to the session variable being empty..riable in the recieving page. ie:-
And in your first page echo the session variable. ie
Using the @ to suppress the errors you will recieve when the page is loaded the first time due to the session variable being empty..a9a]$_SESSION['value']=$_POST['value'];
And in your first page echo the session variable. ie
Using the @ to suppress the errors you will recieve when the page ]
And in your first page echo the session variable. ie
Using the @ to suppress the errors you will recieve when the page is loaded the first time due to the session variable being empty..
And in your first page echo the session variable. ie
Using the @ to suppress the errors you will recieve when the page is loaded the first time due to the session variable being empty..e value into a session variable in the recieving page. ie:-
And in your first page echo the session variable. ie
Using the @ to sup$_SESSION['value']=$_POST['value'];
And in your first page echo the session variable. ie
Using the @ to suppress the errors you will recieve when the page is loaded the first time due to the session variable being empty..
Code: Select all
$_SESSION['value']=$_POST['value'];Code: Select all
echo @$_SESSION['value'];Code: Select all
echo @$_SESSION['value'];Code: Select all
$_SESSION['value']=$_POST['value'];Code: Select all
echo @$_SESSION['value'];And in your first page echo the session variable. ie
Code: Select all
echo @$_SESSIONїng page. ie:-Code: Select all
$_SESSION['value']=$_POST['value'];Code: Select all
echo @$_SESSION['value'];Code: Select all
$_SESSION['value']=$_POST['value'];Code: Select all
echo @$_SESSION['value'];Code: Select all
$_SESSION['value']=$_POST['value'];Code: Select all
echo @$_SESSION['va variable in the recieving page. ie:-Code: Select all
$_SESSION['value']=$_POST['value'];Code: Select all
echo @$_SESSION['value'];Code: Select all
$_SESSION['value']=$_POST['value'];Code: Select all
echo @$_SESSION['value'];Using the @ to suppress the errors you will recieve when the page is loaded the first time due to the session variable being empty..riable in the recieving page. ie:-
Code: Select all
$_SESSION['value']=$_POST['value'];Code: Select all
echo @$_SESSION['value'];And in your first page echo the session variable. ie
Code: Select all
echo @$_SESSION['value'];And in your first page echo the session variable. ie
Code: Select all
echo @$_SESSION['value'];Code: Select all
$_SESSION['value']=$_POST['value'];Code: Select all
echo @$_SESSION['value'];Code: Select all
$_SESSION['value']=$_POST['value'];Code: Select all
echo @$_SESSION['value'];And in your first page echo the session variable. ie
Code: Select all
echo @$_SESSION['value'];- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
The back button behaves a bit awkwardly when trying to do someting like this. More often than not it does NOT load the page again so session variables may not be of any use here.
The best thing to use with the back button is a bit of JavaScript in a hidden IFRAME. You store JavaScript variables in the IFRAME and then pop them back into the form fields onLoad.
The best thing to use with the back button is a bit of JavaScript in a hidden IFRAME. You store JavaScript variables in the IFRAME and then pop them back into the form fields onLoad.
-
andylyon87
- Forum Contributor
- Posts: 168
- Joined: Sat Jan 31, 2004 5:31 am
- Location: Dundee
Why dont you have the form on the same page as the analysis of the form and just use hidden fields. This way you can set the value of the boxes and if one is empty that shouldnt be then the rest will be as they were.
e.g.
e.g.
Code: Select all
<?
print("<input type=text name=test value=$test size=20>");
?>