Sportingbet - Car Insurance Quotes - Submit article - WoW Gold - Debt Consolidation

PDA

View Full Version : Problem passing variables between two pages


HoraceMiles
Mar 1st 2007, 9:18 am
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

nico_swd
Mar 1st 2007, 9:25 am
The variables are case-sensitive. It's $_GET, and not $_get.

HoraceMiles
Mar 1st 2007, 9:30 am
Thank you so much that was the problem. I appreciate your quick response and accuracy..

Miles

jitesh
Mar 14th 2007, 2:53 am
Try This

foreach($_GET as $key => $value){
echo $key." ---- ".$value;
echo "<br>";
}