petermeachem
Programmer
Sorry, I've tried but I don't see what I am supposed to do here. I;ve been playing around with some code I found ages ago in an online tutorial. I get Undefined Variable on the
if ($submit) { line. I've read through most of the other undefined variable posts and I still don't understand. I can see why the error occurs, because it is defined further down. Can this be made to work, or am I barking up the wrong online tutorial?
<?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
if ($submit) { line. I've read through most of the other undefined variable posts and I still don't understand. I can see why the error occurs, because it is defined further down. Can this be made to work, or am I barking up the wrong online tutorial?
<?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