[PHP] Pulling Variables from URL
Is there an easy way to pull all the variables after the URL? Let use say that the page I am looking at is this. www.somewhere.com/pages.php?id=27color=redbgcolor=green Now on the page I want a link to have the 3 variables from above. I know I can do this. a href=another_page.php?id=?php echo $id ?color=?php echo $color ?bgcolor=?php echo $bgcolor ?Click Here/a But I am wondering if there is a basica funciton or call I can use to pull all the values and variables. So the code might be as simple as a href=another_page.php??php call_to_some_function(); ?Click Here/a And get the same result. Thanks all Phillip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pulling Variables from URL
Phillip S. Baker [EMAIL PROTECTED] wrote: Is there an easy way to pull all the variables after the URL? Let use say that the page I am looking at is this. www.somewhere.com/pages.php?id=27color=redbgcolor=green Now on the page I want a link to have the 3 variables from above. I know I can do this. a href=another_page.php?id=?php echo $id ?color=?php echo $color ?bgcolor=?php echo $bgcolor ?Click Here/a But I am wondering if there is a basica funciton or call I can use to pull all the values and variables. So the code might be as simple as a href=another_page.php??php call_to_some_function(); ?Click Here/a phpinfo(); is your friend. Insert into a PHP script which has a query string (the part of the URL after the ?) and look at the environment variables available and listed in the output generated by phpinfo(). The variable you're looking for is $QUERY_STRING, but you really should get familiar with all of the other variables available since there are many that are quite useful. Also see parse_url() in the manual since it lets you grab each of the URL's components separately and you can supply the URL as $SCRIPT_URI, $SCRIPT_URL or something similar. -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pulling Variables from URL
phpinfo(); is your friend. Insert into a PHP script which has a query string (the part of the URL after the ?) and look at the environment variables available and listed in the output generated by phpinfo(). The variable you're looking for is $QUERY_STRING, but you really should get familiar with all of the other variables available since there are many that are quite useful. Also see parse_url() in the manual since it lets you grab each of the URL's components separately and you can supply the URL as $SCRIPT_URI, $SCRIPT_URL or something similar. Thanks that is what I needed. I am starting to learn more about phpinfo. Is there a really good place that documents all the options and variables and such? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pulling Variables from URL
Phillip S. Baker [EMAIL PROTECTED] wrote: Thanks that is what I needed. I am starting to learn more about phpinfo. Is there a really good place that documents all the options and variables and such? You can find info about the environment variables and PHP variables in the PHP manual and apache.org (assuming you run Apache webserver). I'm sure a quick search of google or a few Linux / PHP tutorial sites will turn something up. I don't have any references offhand. -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php