Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    May 2010
    Posts
    215
    Thanks
    0
    Thanked 0 Times in 0 Posts

    passing two value on another page

    I know how to pass a single value on another page, but I can't get the right syntax on passing two value on another page.

    PHP Code:
    header("location: next.php?room=12"); 
    The code above will work

    PHP Code:
    header("location: next.php?room=12 room2=13"); 
    This will make an error

    PHP Code:
    echo"
     <a href="
    search_display_room2.php?id=' . $row['roomnumber'] . '">'.$room_type.' </a>

    In the code above it will work, but I am also trying to pass two value on two different variable here, but I can't get it right.

    PHP Code:
     <a href="search_display_room2.php?id=' . $row['roomnumber'] . ' id2= '. $row['roomnumber'] . ' ">'.$room_type.' </a
    The above code will produce an error

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,020
    Thanks
    15
    Thanked 239 Times in 239 Posts
    The ? is the default separator.
    PHP Code:
    header("location: next.php?room=12?room2=13"); 

  • #3
    Regular Coder
    Join Date
    May 2010
    Posts
    215
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DrDOS View Post
    The ? is the default separator.
    PHP Code:
    header("location: next.php?room=12?room2=13"); 
    it gives a notice Undefined index: room2 , i found the solution i should use & instead right?

    PHP Code:
    header("location: next.php?room=12 & room2=13"); 

  • #4
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,020
    Thanks
    15
    Thanked 239 Times in 239 Posts
    Quote Originally Posted by Anishgiri View Post
    it gives a notice Undefined index: room2 , i found the solution i should use & instead right?

    PHP Code:
    header("location: next.php?room=12 & room2=13"); 
    I keep getting those two mixed up. That must be right.

  • #5
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    ? at the end of a URL indicates the following are GET variables. The & breaks up multiple variables.


  •  

    Posting Permissions

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