Jump to content

Query string differences


BrianM

Recommended Posts

I just found this on another website -

 

The question mark indicates the start of the query string and the ampersand, &, symbol seperates variable=value assignments.

 

... but, what does the ; symbols do and when should it be brought into play?

Link to comment
Share on other sites

After the filename like: http://www.example.com/index.php?act=test&do=something

 

The ? indicates the start of the query and the & is the seperator between each paramater.

 

So the URL above would return the following $_GET array:

 

[act] => test

[do]  => something

 

The use of ; in a URL is not really used as far as I am now unless you are parsing that as one of the parameter values. A common mistake is the use of & in a URL when redirecting via JavaScript. This would accidently represent the URL above like so:

 

http://www.example.com/index.php?act=test&do=something

 

However if you do use & to seperate URL's in HTML (which you should) it would take you to:

 

http://www.example.com/index.php?act=test&do=something

 

:)

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.