Php Form Help

Discussion in 'PHP' started by egjeff4, Apr 4, 2008.

  1. #1
    I am passing values via the url page.php?name=Name of Event

    which gets passed to the new site as: http://site.com/page.php?name=Name of Variable

    my Get function looks like:
    $variablename = $_GET[name];

    but when i try and use it, it only receives the first part of the variable the "Name" and drops the "of Variable"

    is there a way around this? or do i have to string replace the space with a hyphen or something...and then string replace the hyphen with a space in the new file?

    thanks,


    I think my problem is because i'm passing "&" signs....and it turns it into %20a i believe in the URL...i'm working through it now...
     
    egjeff4, Apr 4, 2008 IP
  2. zerxer

    zerxer Peon

    Messages:
    368
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I don't really think there should be a problem if there's spaces in your query. You said you're passing "&" signs though?? They wouldn't be converted to %20a, at least I don't think so. %20 is a space. If you are passing "&" signs, you will have to urlencode them first since & is a delimeter to separate different URL values. Example: page.php?var1=val1&var2=val2. If you tried to do page.php?var1=val1&val2 then it'd think val2 is a separate var rather than part of var1's value.

    Your &'s should be converted to %26
     
    zerxer, Apr 4, 2008 IP
  3. DartPHP

    DartPHP Banned

    Messages:
    71
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Try
    $variablename = $_GET['name']; ?
     
    DartPHP, Apr 4, 2008 IP
    essex likes this.
  4. essex

    essex Guest

    Messages:
    49
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    This looks liek the solution I was thinking of.
     
    essex, Apr 4, 2008 IP