Page 1 of 1

Form not passing data to php

Posted: Tue Jun 23, 2009 3:11 am
by phpguru1
I am running on Mac OS leopard and I dont get the user input from the form when I try to access the variables in my php file
I have a simple html as follows

Code: Select all

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><body>
<h4>Tizag Art Supply Order Form</h4>
<form action="process.php" method="post"> 
<select name="item"> 
<option>Paint</option>
<option>Brushes</option>
<option>Erasers</option>
</select>
Quantity: <input name="quantity" type="text" /> 
<input type="submit" />
</form>
</body></html>
 
My process.php is as follows

Code: Select all

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><body>
<?php
$quantity = $_POST['quantity'];
$item = $_POST['item'];
echo 'You ordered '. $quantity . ' ' . $item . '.<br />';
?>
</body></html>
 
the output I get when I enter some input value in the form and click submit is
something weird like below
'; ?>
can someone tell me what is wrong here ??...
I have simple php files working, have problems only when I try to access data from a html via POST or GET, I am not getting any data
I have spent several hours on this so far
Thanks

Re: Form not passing data to php

Posted: Tue Jun 23, 2009 9:04 am
by CyG64
hi,

ever tried to set the id of the form element to 'quantity' and not (only) the name attribute ?

http://HoloGuides.com/php

Re: Form not passing data to php

Posted: Tue Jun 23, 2009 9:59 am
by phpguru1
Thanks for the suggestion , but can you please elaborate.
I am very new to PHP
How do I set the ID element ?
Thanks for your help

Re: Form not passing data to php

Posted: Tue Jun 23, 2009 10:42 am
by Benjamin
I don't believe your server is configured correctly, so your PHP code is not being executed.