Can't get data from submitted forms
Posted: Fri Dec 19, 2003 8:19 pm
Hi,
I've just started using PHP this morning, learning from the TechiWarehouse tutorial (http://www.techiwarehouse.com/PHP/PHP_Tutorial.html). I'm running PHP 4 on Microsoft Personal Web Server on a Win98 platform.
I was going fine..until I found out that I can't get the data submitted through HTML forms.
The HTML code I am using for testing purposes is as follows:
Then in the result.php file I have the following:
I fill out the form with a colour name, and submit it, but the output only shows this:
I have tried it using both form methods (GET and POST), but still no difference. Is there something I am missing in the PHP coding? In ASP you can't reference a form value with a plain variable, you either need to use request.form() or request.querystring(), but I assuming you don't need to do that in PHP because of the examples given in the tutorial mentioned above.
Is anyone able to shed some light on this?
Thanks
- Tim
I've just started using PHP this morning, learning from the TechiWarehouse tutorial (http://www.techiwarehouse.com/PHP/PHP_Tutorial.html). I'm running PHP 4 on Microsoft Personal Web Server on a Win98 platform.
I was going fine..until I found out that I can't get the data submitted through HTML forms.
The HTML code I am using for testing purposes is as follows:
Code: Select all
<html>
<body>
<form action="result.php" method="get">
<input type="text" name="colour">
<input type="submit" name="submit">
</form>
</body>
</html>Code: Select all
<html>
<body>
<?php
echo "The colour is ";
echo $colour
?>
</body>
</html>(without the colour name that I submitted).The colour is
I have tried it using both form methods (GET and POST), but still no difference. Is there something I am missing in the PHP coding? In ASP you can't reference a form value with a plain variable, you either need to use request.form() or request.querystring(), but I assuming you don't need to do that in PHP because of the examples given in the tutorial mentioned above.
Is anyone able to shed some light on this?
Thanks
- Tim