Jump to content

Question about $_GET variable


Recommended Posts

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

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