Kimp Posted April 23, 2010 Share Posted April 23, 2010 Hi, Am just starting out with PHP. Have a small HTML form that collects user data, then calls a php file to print the form variable. Problem is that the variable is always blank. (Have tried GET, POST, REQUEST). Is there some setting in my php ini that I need to change, perhaps? Belos is the code: HTML: <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>Tyres</td> <td align="center"> <input type="text" name="tyreqty" size="3" maxlength="3"/></td> </tr> <tr> <td>Oil</td> <td align="center"><input type="text" name="oilqty" size="3" maxlength="3"/></td> </tr> <tr> <td>Spark Plugs</td> <td align="center"><input type="text" name="sparkqty" size="3" maxlength="3"/></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="Submit Order"/></td> </tr> </table> </form> PHP: <html> <head> <title>Order Results</title> </head> <body> <h1>Order Results</h1> <?php $tyreqty = $_POST[‘tyreqty’]; echo $tyreqty; ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/199459-can-not-pass-form-variables/ Share on other sites More sharing options...
callesson Posted April 23, 2010 Share Posted April 23, 2010 Did you get any errors ? I got some so i changed this: Try this instead: <?php $tyreqty = $_POST['tyreqty']; echo $tyreqty; ?> // Otherwise your settings is wrong.. Link to comment https://forums.phpfreaks.com/topic/199459-can-not-pass-form-variables/#findComment-1046856 Share on other sites More sharing options...
Kimp Posted April 23, 2010 Author Share Posted April 23, 2010 Thanks Callesson, that was very helpful. I had cut/paste the code from an e-book. Evidently the character which looked like an apostrophe was actually something else. Link to comment https://forums.phpfreaks.com/topic/199459-can-not-pass-form-variables/#findComment-1046862 Share on other sites More sharing options...
callesson Posted April 23, 2010 Share Posted April 23, 2010 Great! No problem:D It's always tricky with those little fellows ^^ Glad I could help Link to comment https://forums.phpfreaks.com/topic/199459-can-not-pass-form-variables/#findComment-1046864 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.