I have been having problems passing variables using html forms. To confirm this problem, I wrote a small bit of code which is shown below. The file name is test01.php.
I am running PHP 4.2.2 on Red Hat Linux 9 with Apache 2.0.
Here's the code and I would appreciate any help.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
if ($submit)
{
// Tried priniting $UserName directly
echo "Hello, $UserName"
// Tried prinitng $UserName with the $_POST[] variable
$UserName = $_POST['UserName'];
echo "Hello, $UserName";
}
else
{
echo '
<form method="post" action="test01.php">
Enter Your Name
<input type="text" name="UserName"></input><br>
<input type="submit" name="submit" value="click"></input>
</form>
';
}
?>
</body>
</html>