Calling a script with an attached variable
I'm coding again after a break of many years!
Attaching variables to script call:
e.g. script.php?order=999
How do you list more than one variable?
Thanks
Dave
I should have posted this in the PHP section. Sorry
Last edited by will_d; Feb 20, 2002 at 09:15 .
Hi Dave,
You can attach multiple variables to the query string by using ampersands:
script.php?order=999&quantity=2&productid=34
To use strings like this then you'll need the correct URL encoded values for things like spaces eg:
script.php?comment=This%20is%20great
PHP offers a function to convert strings or any other variable into proper URL encoded values. Its called urlencode() and you can get more info at http://www.php.net/manual/en/function.urlencode.php
Be careful passing variables like this though. It'd be safer to pass any password values or any confidential data via the POST method using a form. Hope that helps anyway.
Anthony -
How's tings?
24 hours in a day, 24 beers in a case. Coincidence? I think not.
Contact me by : PM ¦ Email ¦ NEW! Carrier Pigeon
SitePoint Enthusiast
script.php?var1=value1& var2=value2
i type less but still come second :P ahah .. next time i move to the nearest place to sitepoint server
Last edited by maelzx; Feb 20, 2002 at 09:26 .
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks