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.

Link to comment
Share on other sites

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 :)

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.