Error in using method GET to transfer value to another page

A

Anonymous

Guest
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...
 
cjzone81 said:
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
 
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.....
 
Back
Top