programming.name Posted June 15, 2010 Share Posted June 15, 2010 Hi, I am relatively comfortable using $_GET variable. But it comes with '&'(ampersand) I have no idea what is going on. I mean please see blow: http://www.example.com/example.php?sid=0&tid=2 Why does it need two(or more) ids and ampersand inbetween? Please explain what is going on. Thanks. Link to comment https://forums.phpfreaks.com/topic/204847-question-about-_get-variable/ Share on other sites More sharing options...
MatthewJ Posted June 15, 2010 Share Posted June 15, 2010 Well, it appears there is an sid and a tid... equal to 0 and 2 respectively, but without seeing the rest of the code, how in the world could anybody know what it is for? Link to comment https://forums.phpfreaks.com/topic/204847-question-about-_get-variable/#findComment-1072346 Share on other sites More sharing options...
vbnullchar Posted June 15, 2010 Share Posted June 15, 2010 sid and tid are two diff parameters and & is the separator Link to comment https://forums.phpfreaks.com/topic/204847-question-about-_get-variable/#findComment-1072348 Share on other sites More sharing options...
programming.name Posted June 15, 2010 Author Share Posted June 15, 2010 My point is; how does each paramater work? Does it work separately? My guess is they work Like this: $_GET['sid']; $_GET['tid']; So as far as I can guess they are two separate params and if sid points page1(of some website) tid indicates element1 (of page1 ) at the same time. Ahhhhhhhwwwwww I am getting confused. Could anyone please show me some kind of easy-to-understnad example?!! Thanks Link to comment https://forums.phpfreaks.com/topic/204847-question-about-_get-variable/#findComment-1072370 Share on other sites More sharing options...
mrMarcus Posted June 15, 2010 Share Posted June 15, 2010 You are just confusing yourself. It is very, very straight-forward in that these are simply two values being carried through the URL (in this case). These variables are can then be used on a page like so: <?php $sid = $_GET['sid']; //$sid is now 0 $tid = $_GET['tid']; //$tid is now 2 Or could be this: <?php //http://www.example.com/example.php?colour=red $colour = $_GET['colour']; //$colour = red This is handy for carrying values from page to page for whatever reason your code calls for it. As was mentioned, the & is just a delimiter and you do nothing with it, it's just a method of separating the parameters, and you can have as many parameters in the URL as you please. Link to comment https://forums.phpfreaks.com/topic/204847-question-about-_get-variable/#findComment-1072407 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.