variables passed from form are not printed in next page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bugthefixer
Forum Contributor
Posts: 118
Joined: Mon Mar 22, 2004 2:35 am

variables passed from form are not printed in next page

Post 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
?>
h@mm3r
Forum Newbie
Posts: 10
Joined: Mon Nov 24, 2003 9:35 am

Post 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: ?>
User avatar
koola
Forum Newbie
Posts: 11
Joined: Mon Mar 22, 2004 4:02 am
Location: Leeds, UK

Post 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
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

User avatar
softsolvers
Forum Commoner
Posts: 75
Joined: Fri Feb 13, 2004 4:26 am
Location: India

Post 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
Post Reply