Holbeach Posted February 6, 2010 Share Posted February 6, 2010 I'm almost embarrased to post this - it must be so simple compared to some of the stuff I've seen on here. This is the first time I've tried to do anything in PHP. I have a HTML form on my site. All I want is for the input that the user enters to be returned, the code: The form: <p><form> <form action="contact_withphp.php" method="post"> <table> <tr> <td>Name:</td> <td><input type="text" name="name" value="" /></td> </tr> <tr> <td>Email:</td> <td><input type="text" name="email" value="" /><br /></td> </tr> <tr> <td valign="top">Enquiry:</td> <td><textarea name="enquiry" rows="6" cols="35"></textarea><br /></td> </tr> <tr> <td></td> <td><input type="submit" name="submit" value="submit enquiry" /></td> </tr> </table> </form></p> The PHP: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php $name = $_POST['name']; $email = $_POST['email']; $enquiry = $_POST['enquiry']; echo 'Thank you for your enquiry' . $name . '<br />'; echo 'I will respond as soon as possible to your address at:' . $email; echo 'You have entered the following message:' . $enquiry . '<br />'; ?> </body> </html> When I fill out the form and click submit, nothing happens except the address bar reads: .../contact_withphp.html?name=wee&email=we&enquiry=e&submit=submit+enquiry I've tried a test.php on my server, it does have PHP 5 installed. When I enter the PHP file URL into firefox I get: Thank you for your enquiry I will respond as soon as possible to your address at You have entered the following message. Help! Quote Link to comment https://forums.phpfreaks.com/topic/191163-_post-problem/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 6, 2010 Share Posted February 6, 2010 <form> <form action="contact_withphp.php" method="post"> Best advice I can give is to proof read your code to make sure it is and does what you expect. Nested <form ....> tags are not valid. The first one encountered is what is used by the browser. A <form> tag with no action or method parameters submits to the current page using the GET method. Quote Link to comment https://forums.phpfreaks.com/topic/191163-_post-problem/#findComment-1007925 Share on other sites More sharing options...
Holbeach Posted February 6, 2010 Author Share Posted February 6, 2010 Thank you so much! I thought it'd be something so stupidly obvious like that... I should have seen it... I should have known better... I blame the terrible headache I've had for a while. Thanks very much, and sorry for wasting your time with such a stupid mistake! James Quote Link to comment https://forums.phpfreaks.com/topic/191163-_post-problem/#findComment-1007934 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.