SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2002
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation 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.

  2. #2
    Shiver me timbers!! anthony_irl's Avatar
    Join Date
    Aug 1999
    Location
    Dublin, Ireland
    Posts
    495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •