I am using PHP 4.1.1, Windows 2000 SP!, and
OHTTP version 2.09. I cannot get the global arrays to work unless register_globals is set to ON in php.ini. I thought their whole purpose was to eliminate the need for setting register_globals.
For example, the following code works if register_globals is ON, but fails if it is set to OFF.
<?php
print("\n"
print("<HEAD>\n"
print("<TITLE>Index.php</TITLE>\n"
print("</HEAD>\n"
print("<BODY>\n"
if ($stage == 0)
{
print("<FORM ACTION=\"$PHP_SELF\" METHOD=\"POST\" "
// Set up input field for first name
print("<LABEL FOR=\"FName\">First Name: </LABEL>\n"
print("<INPUT "
print("TYPE=\"text\" "
print("NAME=\"FName\" "
print("VALUE="
print($_REQUEST["F1Name"]);
print(">\n"
// Set up input field for last name
print("<LABEL FOR=\"LName\">Last Name: </LABEL>\n"
print("<INPUT "
print("TYPE=\"text\" "
print("NAME=\"LName\" "
print("VALUE="
print($_REQUEST["L1Name"]);
print(">\n"
// Set up hidden input field for stage
print("<INPUT "
print("TYPE=\"hidden\" "
print("NAME=\"stage\" "
print("VALUE=1>\n"
// Set up submit button
print("<INPUT "
print("TYPE=\"submit\" "
print("NAME=\"Submit_Button\" "
print("VALUE=\"Try It\">\n"
print("</FORM>\n"
}
else
{
if ($FName=="" OR $LName==""
{
print("<P>You must enter a complete name.</P>\n"
print("<FORM ACTION=\"$PHP_SELF\" METHOD=\"POST\" "
// Set up hidden field for first name
print("<LABEL FOR=\"F1Name\"></LABEL>\n"
print("<INPUT "
print("TYPE=\"hidden\" "
print("NAME=\"F1Name\" "
print("VALUE="
print($_REQUEST["FName"]);
print(">\n"
// Set up hidden field for last name
print("<INPUT "
print("TYPE=\"hidden\" "
print("NAME=\"L1Name\" "
print("VALUE="
print($_REQUEST["LName"]);
print(">\n"
// Set up hidden input field for stage
print("<INPUT "
print("TYPE=\"hidden\" "
print("NAME=\"stage\" "
print("VALUE=0>\n"
// Set up submit button
print("<INPUT "
print("TYPE=\"submit\" "
print("NAME=\"Retry_Button\" "
print("VALUE=\"Re-Try\">\n"
print("</FORM>\n"
}
else
{
print("You entered: " . $FName . " " . $LName);
}
}
print("</BODY>\n"
print("\n"
Can anybody suggest what I might be doing wrong?
OHTTP version 2.09. I cannot get the global arrays to work unless register_globals is set to ON in php.ini. I thought their whole purpose was to eliminate the need for setting register_globals.
For example, the following code works if register_globals is ON, but fails if it is set to OFF.
<?php
print("\n"
print("<HEAD>\n"
print("<TITLE>Index.php</TITLE>\n"
print("</HEAD>\n"
print("<BODY>\n"
if ($stage == 0)
{
print("<FORM ACTION=\"$PHP_SELF\" METHOD=\"POST\" "
// Set up input field for first name
print("<LABEL FOR=\"FName\">First Name: </LABEL>\n"
print("<INPUT "
print("TYPE=\"text\" "
print("NAME=\"FName\" "
print("VALUE="
print($_REQUEST["F1Name"]);
print(">\n"
// Set up input field for last name
print("<LABEL FOR=\"LName\">Last Name: </LABEL>\n"
print("<INPUT "
print("TYPE=\"text\" "
print("NAME=\"LName\" "
print("VALUE="
print($_REQUEST["L1Name"]);
print(">\n"
// Set up hidden input field for stage
print("<INPUT "
print("TYPE=\"hidden\" "
print("NAME=\"stage\" "
print("VALUE=1>\n"
// Set up submit button
print("<INPUT "
print("TYPE=\"submit\" "
print("NAME=\"Submit_Button\" "
print("VALUE=\"Try It\">\n"
print("</FORM>\n"
}
else
{
if ($FName=="" OR $LName==""
{
print("<P>You must enter a complete name.</P>\n"
print("<FORM ACTION=\"$PHP_SELF\" METHOD=\"POST\" "
// Set up hidden field for first name
print("<LABEL FOR=\"F1Name\"></LABEL>\n"
print("<INPUT "
print("TYPE=\"hidden\" "
print("NAME=\"F1Name\" "
print("VALUE="
print($_REQUEST["FName"]);
print(">\n"
// Set up hidden field for last name
print("<INPUT "
print("TYPE=\"hidden\" "
print("NAME=\"L1Name\" "
print("VALUE="
print($_REQUEST["LName"]);
print(">\n"
// Set up hidden input field for stage
print("<INPUT "
print("TYPE=\"hidden\" "
print("NAME=\"stage\" "
print("VALUE=0>\n"
// Set up submit button
print("<INPUT "
print("TYPE=\"submit\" "
print("NAME=\"Retry_Button\" "
print("VALUE=\"Re-Try\">\n"
print("</FORM>\n"
}
else
{
print("You entered: " . $FName . " " . $LName);
}
}
print("</BODY>\n"
print("\n"
Can anybody suggest what I might be doing wrong?