Forum Moderators: coopster
Please point out the blindingly obvious that I am missing! I'm new to this....
<FORM ACTION="HandleForm.php" METHOD=POST>
First Name <INPUT TYPE=TEXT NAME="FirstName" SIZE=20><BR>
Last Name <INPUT TYPE=TEXT NAME="LastName" SIZE=40><BR>
E-mail Address <INPUT TYPE=TEXT NAME="Email" SIZE=60><BR>
Comments <TEXTAREA NAME="Comments" ROWS=5 COLS=40></TEXTAREA><BR>
<INPUT TYPE=SUBMIT NAME="SUBMIT" VALUE="Submit!">
</FORM>
and the PHP script is:
<?php
print "Your first name is $FirstName.<br>\n";
print "Your last name is $LastName.<BR>\n";
print "Your E-mail address is $Email.<BR>\n";
print "This is what you had to say:<BR>\n $Comments<BR>\n";
?>
Could it be the way I have IIS set up? It handles stand alone PHP ok.
<?php
print "Your first name is $HTTP_POST_VARS["FirstName"].<br>\n";
print "Your last name is $HTTP_POST_VARS["LastName"].<BR>\n";
print "Your E-mail address is $HTTP_POST_VARS["Email"].<BR>\n";
print "This is what you had to say:<BR>\n $HTTP_POST_VARS["Comments"]<BR>\n";
?>
not sure but try it.
<?php
print "Your first name is $HTTP_POST_VARS['FirstName'].<br>\n";
print "Your last name is $HTTP_POST_VARS['LastName'].<BR>\n";
print "Your E-mail address is $HTTP_POST_VARS['Email'].<BR>\n";
print "This is what you had to say:<BR>\n $HTTP_POST_VARS['Comments']<BR>\n";
?>
just change the double quotes to single quotes for all $HTTP_POST_VARS[''] variables.
I have escaped the double quotes and now get:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
This was meant to be a simple script to get me on my way! I don't yet understand Jatar_k's second option
<?php
print("Your first name is ".$HTTP_POST_VARS['FirstName'].".<br>\n");
print("Your last name is ".$HTTP_POST_VARS['LastName'].".<BR>\n");
print("Your E-mail address is ".$HTTP_POST_VARS['Email'].".<BR>\n");
print("This is what you had to say:<BR>\n". $HTTP_POST_VARS['Comments']."<BR>\n");
?>
"You can still force the old behaviour by setting register_globals [php.net] to 'On' in your php.ini file."
What is the best time to deliver?
<BR>
<BR> Please deliver from:
<Select Name="start">
<OPTION Value="9">09:00
<OPTION Value="10">10:00
<OPTION Value="11">11:00
<OPTION Value="12">12:00
<OPTION Value="13">13:00
<OPTION Value="14">14:00
<OPTION Value="15">15:00
<OPTION Value="16">16:00
</SELECT>
til
<SELECT NAME="end">
<OPTION Value="9">09:00
<OPTION Value="10">10:00
<OPTION Value="11">11:00
<OPTION Value="12">12:00
<OPTION Value="13">13:00
<OPTION Value="14">14:00
<OPTION Value="15">15:00
<OPTION Value="16">16:00
</SELECT>
<BR><BR>
<INPUT TYPE="Submit">
<INPUT TYPE="Reset">
</FORM>
and my code:
<?php
if ($HTTP_GET_VARS['end'] <= $HTTP_GET_VARS['start']) {
echo " We can only deliver between valid times.";
echo "<BR> We cannot deliver between";
echo "<BR><B>$HTTP_GET_VARS['end'] and $HTTP_GET_VARS['start']</B>";
echo "<a href=\"form_menu2.html\">Try Again</a>";
}
else
{
echo "Great! Expect a delivery between $HTTP_GET_VARS['start'] and $HTTP_GET_VARS['end']";
}
?>
my error is:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in ...\check_time.php on line 8
If I add the "." as Mavherick suggested, I get an unexpected "." error.
I tested the variables using jatar_k's foreach loop and it comes up correctly.
I'm so confused.
if ($HTTP_GET_VARS['end'] <= $HTTP_GET_VARS['start']) {
echo " We can only deliver between valid times.";
echo "<BR> We cannot deliver between";
echo "<BR><B>" . $HTTP_GET_VARS['start'] . " and " . $HTTP_GET_VARS['end'] . "</B>";
echo "<a href=\"form_menu2.html\"><BR>Try Again</a>";
}
else
{
echo "Great! Expect a delivery between " . $HTTP_GET_VARS['start'] . " and " .
$HTTP_GET_VARS['end'] ;
}
?>
Another question though... What is the significance of "." ?
Therefor when interpolation any $HTTP_*_VARS into a double quoted string use either one of the following methods:
- <? echo "ac rules: $HTTP_GET_VARS[ac]"; ?>
- <? echo "ac rules: {$HTTP_GET_VARS['ac']}"; ?>
- <? echo "ac rules: ${HTTP_GET_VARS['ac']}"; ?>
- completely avoid interpolation and use the . operator as has been suggested in previous posts.
Also note that the first way is correct only when used in a double quoted string as explained in [php.net...]