Hey, I'm trying to follow this tutorial to learn PHP. Its a pretty good tutorial; more than once up until this point, I've had to modify the script he gave me because it wasn't working. But I've been able to figure it out. But now I've hit a snag that I can't figure out. I'm ready to bite off my lips and chew them until the flavor runs out to get my mind off of this script. Here it is, straight off the page:
<html>
<body>
<?php
if ($submit) {
// process form
while (list($name, $value) = each($HTTP_POST_VARS)) {
echo "$name = $value<br>\n";
}
} else{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF?>">
First name:<input type="Text" name="first"><br>
Last name:<input type="Text" name="last"><br>
Address:<input type="Text" name="address"><br>
Position:<input type="Text" name="position"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?php
} // end if
?>
</body>
</html>
And when I try to run it, I get this:
Notice: Undefined variable: submit in C:\Program Files\Apache Group\Apache2\htdocs\newuser.php on line 14 as well as the forms.
And when I try to submit, I get this:
Not Found
The requested URL /<br /><b>Notice</b>: Undefined variable: PHP_SELF in <b>C:/Program Files/Apache Group/Apache2/htdocs/newuser.php</b> on line <b>30</b><br /> was not found on this server.
Apache/2.0.40 Server at localhost Port 80
I have apache and PHP 4.something installed. I have mysql installed, but that shouldn't affect anything for this script. I'm just putting stuff in the default main directory that comes with apache and running it localhost/x.php (for instance, this page is localhost/newuser.php).
Now, PHP DOES work on my machine, at least for some things. A simple script like this:
<?php
$myvar = "Hello World";
echo $myvar;
?>
Works fine. Any idea why this script here doesn't work? I like this tutorial, it makes sense to me, I can follow it, but the non-working scripts are killing me. Can someone hook me up with a similar skill-level tutorial? Thanks for any help