RawRecruit
MIS
Hi everyone,
I am a complete novice with PHP and have tried out some tutorials I found at WebMonkey.
I've spent around fifteen hours playing with 3 scripts that use forms to pass variables, but without success.
The error returned is along the lines of :-
"Undefined variable: FName in C:\Inetpub\ on line 15"
using " FName:<input type="Text" name="FName"> within the form.
The tutorial appears to suggest that the variable $FName should automatically be assigned the content of the forms textbox upon hitting the "submit" button.
Is this the case?
I have played around and managed to assign the correct values by cycling through the content of $HTTP_POST_VAR, but I feel sure this is not how it should be done!
The original Webmonkey code is similar to the following; the vars being changed to reflect the required input:-
<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?>">
FName:<input type="Text" name="FName"><br>
Surname:<input type="Text" name="Surname"><br>
Address:<input type="Text" name="Address"><br>
PostCode:<input type="Text" name="PostCode"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?php
} // end if
?>
</body>
</html>
The page fails with "Undefined variable: submit in C:\inetpub......" on the first pass and fails with a "Page cannot be displayed - incorrect address" when recalled.
With the if/else statement commented out the while loop echos the correct names and values.
Am I correct in thinking this may be a configuration problem specific to IIS?
Any ideas would be much appreciated - but please keep the solutions in a step-by-step format!
I'm really at my wits end with this problem
Sorry its such a long posting!
Many Thanks in advance.....
I am a complete novice with PHP and have tried out some tutorials I found at WebMonkey.
I've spent around fifteen hours playing with 3 scripts that use forms to pass variables, but without success.
The error returned is along the lines of :-
"Undefined variable: FName in C:\Inetpub\ on line 15"
using " FName:<input type="Text" name="FName"> within the form.
The tutorial appears to suggest that the variable $FName should automatically be assigned the content of the forms textbox upon hitting the "submit" button.
Is this the case?
I have played around and managed to assign the correct values by cycling through the content of $HTTP_POST_VAR, but I feel sure this is not how it should be done!
The original Webmonkey code is similar to the following; the vars being changed to reflect the required input:-
<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?>">
FName:<input type="Text" name="FName"><br>
Surname:<input type="Text" name="Surname"><br>
Address:<input type="Text" name="Address"><br>
PostCode:<input type="Text" name="PostCode"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?php
} // end if
?>
</body>
</html>
The page fails with "Undefined variable: submit in C:\inetpub......" on the first pass and fails with a "Page cannot be displayed - incorrect address" when recalled.
With the if/else statement commented out the while loop echos the correct names and values.
Am I correct in thinking this may be a configuration problem specific to IIS?
Any ideas would be much appreciated - but please keep the solutions in a step-by-step format!
I'm really at my wits end with this problem
Sorry its such a long posting!
Many Thanks in advance.....