Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recieve from <FORM> 1

Status
Not open for further replies.

blekfis

Programmer
Oct 19, 2001
38
SE
Search is under maintenance, so I haven't searched Tek-Tips...

<Newbie-warning>

To send data from a form to a php-file, does register_globals always have tp be set to On?

This little form:
<form name="form1" method="post" action="test.php">
<input name="t1" type="text">
<input name="t2" type="text">
<input type="submit" name="Submit" value="Submit">
</form>

is supposed to be recieved by this:
<?php
echo $t1;
echo $t2;
?>

Is there a way to do this with register_globals set to Off? I tried $_GET['t1'] without luck...

</Newbie-warning>
 
no register globals should be off

user

Code:
<?php
echo $_POST['t1'];
echo $$_POST['t2'];
?>

and use $_GET['varname'] if the form uses the GET method

$_COOKIE['varname'] for cookies
and $_SESSION['varname'] for session variables

Bastien

Cat, the other other white meat
 
Argh! Forgot $_POST... Sometimes the easiest things...
Thanx! Now I'll save some hair at least ;-)

//N!cklas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top