Jump to content

[SOLVED] How does vars in address bars work?


Fabis94

Recommended Posts

In forums (for example this one) the address says /index.php?action=post;board=1.0.

How does it work? It doesn't create new pages (posts, topics, forums etc.), but just makes stuff in the same old one (index.php). I've seen it on other websites too. Like the page is comments.php?x=1 and its the page one of something, then you click Go To Page 2 and nothing in the address bar changes just the x=1 becomes x=2, but the whole page is different.

These addresses are sending variables via the GET method. Therefore if in index.php you do something along the lines of:

ADDRESS: www.site.com/index.php?x=1&y=2
$x = $_GET['x'];
$y = $_GET['y'];
echo $x;
echo $y;

It will output 12

You can use it alot in <a href="index.php?variable=<?php echo $variable?>">

 

Hope this helps :)

Archived

This topic is now archived and is closed to further replies.

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