Error in using method GET to transfer value to another page

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply

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
<input type="Submit">

in try.php

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


Sun Aug 11, 2002 8:48 am

cjzone81 wrote:the error message is undefined variable team in xxx.php

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


Sun Aug 11, 2002 8:39 pm

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


Post Reply