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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.