basic form processing
| From: | Bill Hudspeth | Date: | Thu, 23 May 2002 15:58:21 +0000 |
| Subject: | basic form processing | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-13945@lists.php.net to get a copy of this message | ||
I am new to PHP and have been trying without success to process a very
simple form. My basic problem is trying to pass variables from a form to
another page, and to echo them in a results page.
I understand that the most recent versions of PHP allow you to pass
user-entered form variables in the $_POST or $_GET associative arrays. I
have set the "register_globals = off" in my php.ini file (under C:\winnt,
running Win2000 and Microsoft IIS). When I try to submit the form, the
results page is displayed without the values of the two form variables. I
would very much appreciate some help with this simple problem. The basic
code for my form (form_a.php) is:
************************************************************************
<HTML>
<HEAD>
<TITLE>Test Form One</TITLE>
</HEAD>
<BODY>
<B>
<H2>Test Form One</H2>
Fill out the information below
<FORM ACTION='results_1.php'>
Your First Name: <INPUT TYPE="Text" NAME="FirstName">
<BR>Your Last Name: <INPUT TYPE="Text" NAME="LastName">
<BR><INPUT TYPE="submit" VALUE="Submit Data">
</FORM>
</B>
</BODY>
</HTML>
************************************************************************
The target page that displays the form variables (results_1.php) is as
follows:
<HTML>
<HEAD>
<TITLE>Results from Form One</TITLE>
</HEAD>
<BODY>
<B>
<H2>Results from Form One</H2>
<?PHP
echo "Thanks $_POST[FirstName] $_POST[LastName]";
?>
</B>
</BODY>
</HTML>
Thanks in advance, Bill