Jump to content

Using $_GET


hanlonj

Recommended Posts

I want to pass the value if a variable to another page by attaching it to the end of the href.

something like this:[code]<a href "nextPage.php?myValue='My Value'">Next Page</a>[/code]

I then want to grab it on the next page using like:

[code]$msg = $_GET[myValue][/code]

Then I want to print this value to the screen like:
[code]echo $msg;[/code]

I can't seem to get it to work but I think it's just a small syntax problem. Can anyone give me a snippet example of how I would go about this please or point me in the right direction?

Thank you.

John

Link to comment
https://forums.phpfreaks.com/topic/22923-using-_get/
Share on other sites

change $msg = $_GET[myValue] to $msg = $_GET['myValue'].  it should work this way. 

also, verify that the $_GET array is even seeing the variable passed.  use this function on the nextpage.php to see what's in the $_GET array:

[code]echo "<pre>";
print_r($_GET);
echo "</pre>";[/code]
Link to comment
https://forums.phpfreaks.com/topic/22923-using-_get/#findComment-103426
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.