Error in using method GET to transfer value to another page

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

cjzone81
New php-forum User
New php-forum User
Posts: 5
Joined: Sun Aug 11, 2002 8:26 am

Error in using method GET to transfer value to another page

Postby cjzone81 » Sun Aug 11, 2002 8:39 am

hi guys...

i'm a newbie in php.lately i try to use method GET to transfer variable value to another page.but if fail.
the error message is undefined variable team in xxx.php

this is my code:
in somepage.html
<form action="http://localhost/try.php" method="GET">
<select name="team">
<option value="Cubbies">Chicago cubs
<option value="Pale Hose">Chicago White Sox
</select>
<p>
<input type="Submit">

in try.php
<?php
print("$team");
?>

i thought that it might work cos it's only a simple task.can anyone help with this..?pls...

DoppyNL

Re: Error in using method GET to transfer value to another p

Postby DoppyNL » Sun Aug 11, 2002 8:48 am

cjzone81 wrote:the error message is undefined variable team in xxx.php
print("$team");

the variable $team is not defined. most likely to be caused by an configuration option in php.ini -> register_globals = off
wich means that posted variables are not made global in you're script.
leave it off, it's off for security reasons.

you can acces posted variables with $_REQUEST['team'] or $_GET['team']
$HTTP_POST_VARS['team'] if you're using an older php-version.

Greetz Daan

cjzone81
New php-forum User
New php-forum User
Posts: 5
Joined: Sun Aug 11, 2002 8:26 am

Postby cjzone81 » Sun Aug 11, 2002 8:39 pm

thanx man.
i tried it.it works.
i even try the register_global by turning it on.
it works too.
but i'll stick with ur idea.
using $_GET & $_REQUEST.

THANX A LOT.....


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests