Evrim Posted June 18, 2009 Share Posted June 18, 2009 Hello I have a form on html page which posts its results to a PHP page. PHP page gets the values of form elements and redirects to the right page. So at the end of PHP page I have: if ($v==1) $resulturl ='../thanks.htm'; else $resulturl ='../incomplete.htm'; $headers = "From: $from ". "\r\n"; header("Location: $resulturl"); My question is, how can I pass the variable $v to my page incomplete.htm? Thank you for your help ??? EDITED BY akitchin: added code tags. use them in all future posts please. Quote Link to comment https://forums.phpfreaks.com/topic/162779-passing-variable-values-between-pages/ Share on other sites More sharing options...
Maq Posted June 18, 2009 Share Posted June 18, 2009 First you should use double quotes for your link variables. Second, you have to use the GET method and tack on the variable to the end of the URL. Or you can use a hidden field and pass it along. Or you can use sessions. The first option is the easiest. if ($v==1) $resulturl ="../thanks.htm"; else $resulturl ="../incomplete.htm?v=$v"; $headers = "From: $from ". "\r\n"; header("Location: $resulturl"); Now when you get the incomplete.php you have to use $_GET['v']; to retrieve the value. Quote Link to comment https://forums.phpfreaks.com/topic/162779-passing-variable-values-between-pages/#findComment-859022 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.