Click to See Complete Forum and Search --> : Question about the "include" code
netzeye
09-09-2008, 03:01 PM
Hi guys, from the help of a kind forum member, I was able to use the include code successfully, and learn how to use it to make my pages easier to edit with the index.php?id=1.
Now, I want to know if I can have an id inside an existing id? Here is an example: http://www.goscam.com/en/en_product_view.php?Id=114
If you guys go here and click on any of the links on the left navigation, it will have "sort id" and "layers" (http://www.goscam.com/en/en_product.php?S_Id=38&Sort_Id=37&Sort_Layer=2). Can anyone please tell me what those 2 means?
Please pardon my bad English.
Kyleva2204
09-13-2008, 12:13 AM
the id, sort_id, and layers is irrelevant. Its just populating a variable in PHP called $_GET. For instance, in your first url, the variable $_GET['Id'], would have the value of 144.. And on your last example, the variable $_GET['Sort_Layer'] will have the value of 2. You are not tied down by just numbers, text works also.
Hope this helps.
hiredeveloper
09-13-2008, 12:57 AM
the id, sort_id, and layers is irrelevant. Its just populating a variable in PHP called $_GET. For instance, in your first url, the variable $_GET['Id'], would have the value of 144.. And on your last example, the variable $_GET['Sort_Layer'] will have the value of 2. You are not tied down by just numbers, text works also.
Hope this helps.
Will go with Kyleva2204
____________________
netzeye
09-16-2008, 04:05 PM
But it seems like in the 2nd link, they "combined" 2 $_GET tags using 2 variables (if this is correct word to use) 'id' and 'Sort_Layer'.
Kyleva2204
09-16-2008, 04:09 PM
To populate the $_GET variables, you add on a ? at the end of your url like this:
mysite.com/index.php?this_var=hi
this populates $_GET['this_var'] to be "hi". To have more than one $_GET be populated, you simply separate each parameter with an &, like so:
mysite.com/index.php?this_var=hi&next_var=hello
which would populate $_GET['this-var'] with "hi", and $_GET['next_var'] with "Hello". you can add onto this like so:
mysite.com/index.php?this_var=hi&next_var=hello&more_stuff=w00t&moreMore=fasdfasdf
so, you can easily assume how that would come out..
Hope this helps :)
netzeye
09-16-2008, 04:21 PM
Thanks Kyleva, it helped! But can I ask, what is the point of having more than one $_GET? In this case, do you know why goscam.com is using it? Thx!
Kyleva2204
09-16-2008, 04:24 PM
Well, I haven't a clue what their doing.. But a real life example would be to do something like this:
http://mysite.com/?action=grab_page&id=1
which, in PHP you would have it grab a page (becasue of $_GET['action'] is set to grab_page) and then the $_GET['id'] the id of the page in a MySQL database or relation to a file.
netzeye
09-16-2008, 04:34 PM
Well, I haven't a clue what their doing.. But a real life example would be to do something like this:
http://mysite.com/?action=grab_page&id=1
which, in PHP you would have it grab a page (becasue of $_GET['action'] is set to grab_page) and then the $_GET['id'] the id of the page in a MySQL database or relation to a file.
Oh ok, so it's kind of like my site then? (http://www.netzeye.com/Products/view_product.php?id=1001)
Basically just using a single page to display other pages in the content area by using the include code?
Kyleva2204
09-16-2008, 04:37 PM
yes, that is one use of using $_GET. Another use is some people submit a form using GET so it populates all the forms data in the URL for use with $_GET.