By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,652 Members | 1,842 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,652 IT Pros & Developers. It's quick & easy.

PHP not getting variables in HTML forms

P: n/a
Hi,

Just installed PHP, and Apache. Am having problems with the PHP to
get form data from an HTML file. Specifically, I can not obtain the
variable "tireqty" in a PHP file called by an HTML file. The files'
contents are listed as follow:

-----------------------------
The following is the HTML file
-----------------------------
<form action="processorder.php" method=post>
<table border=0>
<tr bgcolor=#cccccc>
<td width=150>Item</td>
<td width=15>Quantity</td>
</tr>
<tr>
<td>Tires</td>
<td align=center><input type="text" name="tireqty" size=3
maxlength=3></td>
</tr>
<tr>
<td colspan=2 align=center><input type=submit value="Submit
Order"></td>
</tr>
</table>
</form>
-----------------------------
The following is the PHP file 'processorder.php'
-----------------------------
<html>
<head>
<title>abcd</title>
</head>
<body>
<?
echo $tireqty." tires<br>";
?>
</body>
</html>
-----------------------------
I know PHP and Apache are working becasue I am able to to have an HTML
page to load a PHP page to do a for loop and use the "echo" function
to print the loop iterations. So I'm not sure why PHP can't access
the variable "tireqty". Is there some settings in the PHP engine that
I need to check for this?

Thanks
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Titus wrote:
Specifically, I can not obtain the
variable "tireqty" in a PHP file called by an HTML file. -----------------------------
The following is the HTML file
-----------------------------
<form action="processorder.php" method=post>
<input type="text" name="tireqty" size=3
maxlength=3>
<input type=submit value="Submit
Order">
</form>
-----------------------------
The following is the PHP file 'processorder.php'
-----------------------------
<?
echo $tireqty." tires<br>";
?>
----------------------------- I'm not sure why PHP can't access
the variable "tireqty". Is there some settings in the PHP engine that
I need to check for this?


echo $_POST['tireqty']." tires<br>";

register_globals:
http://us3.php.net/register_globals

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.