Hi,
I just got a book on PHP and trying to learn the form stuff. I have these two pages, one that takes a users name and address and sends it to the other page:
listing9.2.php:
<form action="listing9.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>
listing9.3.php:
<html>
<head>
<title>Listing 9.3 Reading input from the form in Listing 9.2</title>
</head>
<body>
<?php
print "Welcome <b>$user</b><P>\n\n";
print "Your address is:<P>\n\n<b>$address</b>";
?>
</body>
</html>
The browser shows this error message regardless of whether global variables are on or off:
Notice: Undefined variable: user in C:\Program Files\Apache Group\Apache2\htdocs\Testcode\listing9.3.php on line 7
Welcome
Notice: Undefined variable: address in C:\Program Files\Apache Group\Apache2\htdocs\Testcode\listing9.3.php on line 8
Your address is:
I am well frustrated as it says this should be easy! I have tried using "GET" and "POST". Please can anyone shed some light?
Thanks!
I just got a book on PHP and trying to learn the form stuff. I have these two pages, one that takes a users name and address and sends it to the other page:
listing9.2.php:
<form action="listing9.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>
listing9.3.php:
<html>
<head>
<title>Listing 9.3 Reading input from the form in Listing 9.2</title>
</head>
<body>
<?php
print "Welcome <b>$user</b><P>\n\n";
print "Your address is:<P>\n\n<b>$address</b>";
?>
</body>
</html>
The browser shows this error message regardless of whether global variables are on or off:
Notice: Undefined variable: user in C:\Program Files\Apache Group\Apache2\htdocs\Testcode\listing9.3.php on line 7
Welcome
Notice: Undefined variable: address in C:\Program Files\Apache Group\Apache2\htdocs\Testcode\listing9.3.php on line 8
Your address is:
I am well frustrated as it says this should be easy! I have tried using "GET" and "POST". Please can anyone shed some light?
Thanks!