SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot codewrecker's Avatar
    Join Date
    Feb 2002
    Location
    U.S.A.
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problem with explode

    can't get it to work. I've used explode before. I must be overlooking the obvious:

    link to second page:
    PHP Code:
     <a href="auth_articlelist.php?id=$auth_ID+$auth_fullname"
    second page:
    PHP Code:
    $value$_GET['id'];
        
      list(
    $authorid,$authorname) = explode("+",$value);
      
    echo 
    "<h2>".$authorname."</h2>"
    it just aint work'n??
    CodeWrecker

  2. #2
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    + is used as a space in URL's sometimes, and I believe PHP automatically converts it to a space.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  3. #3
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why don't you just use seperate URL variables, i.e.:

    PHP Code:
     <a href="auth_articlelist.php?id=$auth_ID&name=$auth_fullname"
    And then on the second page:

    PHP Code:
    $id $_GET['id'];
    $name $_GET['name'];

    echo 
    "<h2>".$authorname."</h2>"
    Or is this stopping you doing something else?

    -Sam
    Sam Hastings

  4. #4
    SitePoint Zealot codewrecker's Avatar
    Join Date
    Feb 2002
    Location
    U.S.A.
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks to both. Actually I'm not very good at PHP and didn't know I could do it that way. I had used explode before in forms which is...now I know different than sending multiple variables in a link. Again, thanks to both of you. You were both correct in you information.
    CodeWrecker

  5. #5
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem

    Glad I could be of assistance!

    -Sam
    Sam Hastings


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
  •