Page 1 of 1

variables passed from form are not printed in next page

Posted: Mon Mar 22, 2004 2:35 am
by bugthefixer
i ran the same code on two system configured with php and on 1 system it was ruunig smoothly but on the other it is not printing variable value but it print rest of the string.
code for first page i.e form is<html>
<form action="eg9.3.php" method="GET">
<input type="text" name="user">
<br>
<textarea name="address" rows="5" cols="40">
</textarea>
<br>
<input type="submit" value="hit it!">
</form>

and the code for recieving page is

6: <?php
7: print "Welcome <b>$user</b><P>\n\n";
8: print "Your address is:<P>\n\n<b>$address</b>";
9: ?>

this code works well on one system but not on other it is not printing the values of the variables. so the problem is with php..kan anyboy tell me wat actually the problm is
?>

Posted: Mon Mar 22, 2004 2:54 am
by h@mm3r
Maybe the other server has 'register_globals' turned off?

Then you should use

6: <?php
7: print "Welcome <b>".$_GET['user']."</b><P>\n\n";
8: print "Your address is:<P>\n\n<b>".$_GET['address']."</b>";
9: ?>

Posted: Mon Mar 22, 2004 4:10 am
by koola
Hi,

Try:

Code: Select all

$user = $_GET&#1111;'user'];
$address = $_GET&#1111;address];

Print "Welcome $user<br>"
Print "Your address is $address"
Also, make sure you try "post"

Code: Select all

$user= $_POST&#1111;'user'];
$address = $_POST&#1111;'address'];

echo "Welcome $user<br>"
echo "Your address is $address"
Hope this helps you in some way :D

Posted: Mon Mar 22, 2004 4:23 am
by patrikG

Posted: Mon Mar 22, 2004 4:59 am
by softsolvers
Hello
Hope ur problem has been solved,the problem may be due to the version problem or the register_global in php.ini