passing multiple vars in url - possible?

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
php-forum Active User
php-forum Active User
Posts: 264
Joined: Tue Apr 08, 2003 5:18 am
Location: Ottawa, Canada

Fri Aug 29, 2003 4:20 am

you can pass more than one variable by using the & operand.


print ' <a href="calendar_emp.php?to=1&from=2"><strong>calendar</strong></a>';

to add on more vars use & :wink:

User avatar
Posts: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Fri Aug 29, 2003 4:22 am

Code: Select all

print ' <a href="calendar_emp.php?to=1&variable1=value1&variable2=valuse2"><strong>calendar</strong></a>';
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";

User avatar
php-forum Super User
php-forum Super User
Posts: 1279
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India

Fri Aug 29, 2003 9:00 pm

you can pass as many variables you want,

but make sure what is the length of url that is supported by the browser, older browser support length upto 255 chars.

Swirlee do you know what is the length supported by latest browsers? i don't know!!

User avatar
Posts: 2257
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Fri Aug 29, 2003 11:12 pm

There's no standard as to how long a URL should be, but according to this page at MS, IE (at least up to 5.5, which is a very popular version) supports URLs up to 2083 characters. I haven't a clue what the significance of this number is (as a CS kid I'm interested in this stuff) as it's 2^11+35, which doesn't seem mathematically significant at all. This page suggests the following lengths for other browsers (circa 5/03):

sidki3003 wrote:IE > 5: 2,083 (508 in IE 6.0)
Mozilla > 1.3: >20,000
Netscape 4.75: 1,848
Opera 7.x: 4,094

Interesting that IE6 brought the max length down to 508. Some URLs, like those from MapQuest, can get pretty damn long. It would be interesting to see a survey of average URL lengths for popular sites like Amazon, eBay, and MapQuest (though eBays URLs are refreshingly sane in length). By the way, the only number up there that doesn't appear to be mathematically arbitrary is Opera, which is just two shy of 2^12. Wonder what they do with the other two bytes. :D

Some URL length tests (in bytes):
Google Search for "neon pink": 65
MSN Search for "neon pink" (typed into IE address bar): 65
MSN Search for "neon pink" (typed in at 58
eBay Search for "neon pink": 168
MapQuest Search for directions from Orlando, FL to Montreal, BC (a 61-hour drive): 149
Amazon page for 3M Post-it(R) Standard Flags, Neon Pink, Pack Of 2: 146 page for The Usborne Book of Decorating T-Shirts: 100
Search of for 1040EZ: 179 search for "PHP" in New York City, NY in Internet/E-Commerce: 109 page for a decent PHP job (check it out, I'm tempted myself): 153
URL as UI column at, from search page (cruel irony): 120

Alright, I was bored, so I came up with those. I was actually surprised by the MapQuest URL -- they used to be really, really long (e.g. wrapping 4-5 lines in an e-mail (80 cols)). Post your own if you find any ridiculously long URLs. Looks like the worst offender is the IRS. Surprise, surprise. :mrgreen: eBay's search URLs are long, but their actual auction pages have pretty short URLs.

Here's a good discussion of URL length that you should all consider in your projects: URLs Matter. A lot. (59)

Don't ask where the neon pink thing came from. It's late and it was the first thing that popped into my head.

New php-forum User
New php-forum User
Posts: 193
Joined: Sat Mar 29, 2003 11:57 pm
Location: Auckland, New Zealand

Sat Aug 30, 2003 2:21 pm

I really don't know why anyone would be using 500 characters.

I typed a whole lot of f's after a url in IE 6 and it stopped me after 271 but then i tried again by putting the cursor back a couple of characters and gave up at 1853.

Then I pressed enter and all of those 1853 characters were allowed to stay in. Mind you, the page toook a very, very long time to load (I added the f's onto the end of this "")

I bet Internet explorer could fit a lot more too.

In Mozilla I gave up at 1375. When I pressed enter it sent the whole 1375 long URL through as well.

All in all I have wasted my morning.

Post Reply