ms_dos10 Posted October 6, 2006 Share Posted October 6, 2006 Hi i have problem with header function , i want send or pass variable from one page to another page with help of header function .frist page : $mymsg = 'Unon User Name & Password Plz Try Again <br>'; header("Location: http://index.php?msg=$mymsg"); second page here i want pass my variable :i'll get it like that or what 'couse its not working with me here . <?phpif(isset($_GET['$msg'])){echo "Wrong :" . $_GET['$msg']; }?> Link to comment Share on other sites More sharing options...
jesh Posted October 6, 2006 Share Posted October 6, 2006 Two things appear to be happening here: The value of "msg" will always be "$mymsg" rather than the value that is assigned to your $mymsg variable. You would most likely run into problems with the spaces, ampresand (&) and angle brakets in the value. It needs to be url encoded. I'm not a PHP developer, so forgive me any errors, but something like this should fix it: $mymsg = 'Unon User Name & Password Plz Try Again <br>';header("Location: http://index.php?msg=".urlencode($mymsg)); Of course, you'll also need to decode the string once you get to the second page: $mymsg = urldecode($_GET['$msg']); Link to comment Share on other sites More sharing options...
jhecht Posted October 7, 2006 Share Posted October 7, 2006 $mymsg = 'Unon User Name & Password Plz Try Again <br>'; header("Location: ./index.php?msg=".urlencode($mymsg)); Link to comment Share on other sites More sharing options...
ms_dos10 Posted October 7, 2006 Author Share Posted October 7, 2006 thanx for both of u , i get it Link to comment Share on other sites More sharing options...
reportingsjr Posted October 8, 2006 Share Posted October 8, 2006 just a question to Jesh: what are angle brackets? Are you talking about the less than (<) and great than (>) symbols? Cause thats what they are called by the people who design web programming languages (like the code to display an < is <) Link to comment Share on other sites More sharing options...
jesh Posted October 9, 2006 Share Posted October 9, 2006 just a question to Jesh: what are angle brackets? Are you talking about the less than (<) and great than (>) symbols? Cause thats what they are called by the people who design web programming languages (like the code to display an < is <)Yeah, I call the "less than" (<) and "greater than" (>) symbols "angle brackets". Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now