komquat Posted March 8, 2006 Share Posted March 8, 2006 HELP!! I do not know why one would use this, or how to even start using. I am looking for a GOOD tutorial on this and and explaination on why to use it. Sample code would be great too.Thanks for all the help in advance! Quote Link to comment https://forums.phpfreaks.com/topic/4459-should-my-address-look-like-this/ Share on other sites More sharing options...
lessthanthree Posted March 8, 2006 Share Posted March 8, 2006 You would generally use this to send information across pages or changing a page's content based upon what follows the "?" in the url.Basically you are passing data via the URL and then you obtain it using the $_GET superglobal.I.ewww.mysite.com/index.php?action=showpagewould mean:$_GET["action"] holds the value "showpage"You can pass more than one piece of info as well, you just need to use '&' i.ewww.mysite.com/index.php?show=comments&id=6this would result in $_GET containing[code]$_GET["show"] = "comments"$_GET["id"] = 6[/code]$_GET is an array so you may view all of it's contents using print_r and of course treat it as you would any other way.Sending the data to the url is as easy as you might think.[code]<a href='index.php?show=comments&id=6'>link</a>[/code]Of course you can (and most of the time, probably will be) using variables in the url[code]<a href='index.php?show=$show&id=$id'>link</a>[/code]One word of warning. If you plan on doing any sql queries based upon information contained in $_GET make sure you have validated and cleaned the info. GET is one of the most open methods of SQL injection that there is.Hope that helps! Quote Link to comment https://forums.phpfreaks.com/topic/4459-should-my-address-look-like-this/#findComment-15488 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.