retrieving the variable/value from the url HELP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
glennn.php
Forum Commoner
Posts: 41
Joined: Sat Jul 08, 2006 12:26 pm

retrieving the variable/value from the url HELP

Post by glennn.php »

having this url:

h**p://domain.com/file.php?message=this%20value ...

how can i retrive JUST the variable/value? - i realize $_SERVER['REQUEST_URI'] will get me the entire string after the .com/, but i need to get the variable's value (what's after the =) into a javascript...

i really appreciate the help,
GN
nowaydown1
Forum Contributor
Posts: 169
Joined: Sun Apr 27, 2008 1:22 am

Re: retrieving the variable/value from the url HELP

Post by nowaydown1 »

You want:

Code: Select all

 
$queryStringVar = $_GET["message"];
 
Which will give you the value of the 'message' parameter in your query string. Then you can just have PHP write out a little js if you need to pass it to javascript.
glennn.php
Forum Commoner
Posts: 41
Joined: Sat Jul 08, 2006 12:26 pm

Re: retrieving the variable/value from the url HELP

Post by glennn.php »

awesome - actually, i knew the first part (i'm just an unthinking moron) but you helped me with the second issue - right, i can just have PHP echo a js function. cool.

awesome, again. thanks
Post Reply