Problem passing variables between two pages

Discussion in 'PHP' started by HoraceMiles, Mar 1, 2007.

  1. #1
    I am trying to pass variable between pages using the get method. I know it is dangerous but I need to see what is being passed then Iwill change to the post method. Unfortunately my recieving page only recieves the first variable I am passing and none of the rest. Here is part of the code:

    Sending page:

    <FORM name=create onsubmit="return OnSubmitForm()" action=somepage.php method=GET>

    Resulting URL:

    http://www.domain.com/chat/phpbb2/somepage.php?rm=Milestest5&topic=test&rmaxusers=25&rmpriv=Enable&password=test&chatmode=1&newroom=1

    recieving page code:

    <html>
    <head>
    <title>ServerAPI Test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>
    <body>
    <?php
    $host = "127.0.0.1";
    $port = 51127;
    $name = $_get['rm'];
    $desc = $_get['topic'];
    $max = $_get['rmaxusers'];
    $member = $_get['rmpriv'];
    $pwd = $_get['password'];

    Echo "Name = $rm";
    Echo "<br / >";
    Echo "Owner = $owner";
    Echo "<br / >";
    Echo "Description = $desc";
    Echo "<br / >";
    Echo "max = $max";
    Echo "<br / >";
    Echo "members = $member";
    Echo "<br / >";
    Echo "pwd = $pwd";
    Echo "<br / >";

    Result of the recieving page:

    Name = Milestest5
    Owner =
    Description =
    max =
    members =
    pwd =

    As you can see I only receive the first variable which is the name but not any of the others. Does anyone know what would cause this behavoir?

    I would appreciate any help I can get, I am new to php and still learning..

    Miles
     
    HoraceMiles, Mar 1, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    The variables are case-sensitive. It's $_GET, and not $_get.
     
    nico_swd, Mar 1, 2007 IP
  3. HoraceMiles

    HoraceMiles Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you so much that was the problem. I appreciate your quick response and accuracy..

    Miles
     
    HoraceMiles, Mar 1, 2007 IP
  4. jitesh

    jitesh Peon

    Messages:
    81
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Try This

    foreach($_GET as $key => $value){
    echo $key." ---- ".$value;
    echo "<br>";
    }
     
    jitesh, Mar 14, 2007 IP