goosefrikin Posted March 25, 2009 Share Posted March 25, 2009 Hi, just started playing around with php yesterday and i've unfortunately hit a dead end Here is a php and HTML code that I retrieved from an online tutorial: <html> <title>Processing Forms</title> <body> <form method="POST" action="process.php"> Name: <input type="text" name="name"> <p> Sex: <input type="radio" name="sex" value="M"> Male <input type="radio" name="sex" value="F"> Female <p> Annual Income: <select name="income"> <option value="$25,000">Under $25,000 <option value="$25,000 to $50,000">$25,000 to $50,000 <option value="$50,000 and higher">$50,000 and higher </select> <p> <input type="submit" name="submit" value="Submit"> </form> </body> </html> and here's the php code <html> <head> <title>process.php</title> </head> <body> <?php print "Name: <b>$_POST['name']</b><br />"; print "Sex: <b>$_POST['sex']</b><br />"; print "Annual income: <b>$_POST['income']</b><br />"; ?> </body> </html> i am able to go through the html and click submit but the php code doesn't do anything...like the resulting website just gives me this: $_POST['sex'] "; print "Annual income: $_POST['income'] "; ?> I have no idea whats wrong..ive tried many different tutorials with HTML forms and PHP and i get the same result. Please help!!! Link to comment https://forums.phpfreaks.com/topic/150982-solved-phphtml-form/ Share on other sites More sharing options...
trq Posted March 25, 2009 Share Posted March 25, 2009 Have you installed and configured php on your server? Link to comment https://forums.phpfreaks.com/topic/150982-solved-phphtml-form/#findComment-793215 Share on other sites More sharing options...
WolfRage Posted March 25, 2009 Share Posted March 25, 2009 Got beat to the punch... Link to comment https://forums.phpfreaks.com/topic/150982-solved-phphtml-form/#findComment-793218 Share on other sites More sharing options...
goosefrikin Posted March 25, 2009 Author Share Posted March 25, 2009 yes ive installed apache ive written other codes and theyve worked Link to comment https://forums.phpfreaks.com/topic/150982-solved-phphtml-form/#findComment-793230 Share on other sites More sharing options...
WolfRage Posted March 25, 2009 Share Posted March 25, 2009 is Process saved as a .php with no extra extensions... also try making a page that just includes this. <?php phpinfo(); ?> save as info.php Link to comment https://forums.phpfreaks.com/topic/150982-solved-phphtml-form/#findComment-793233 Share on other sites More sharing options...
goosefrikin Posted March 25, 2009 Author Share Posted March 25, 2009 ok here's what i did i saved the html as tut10.html and saved the php as process.php then i open tut10.html and it takes me to a webpage on firefox in which the html form appears...i then enter data into it and i click submit and that subsequently sends me to process.php and that is where the problem lies as this $_POST['sex'] "; print "Annual income: $_POST['income'] "; ?> appears on that page wolf i did try phpinfo when i first started using php and it did work and i have done a couple of other tutorials today and theyve all worked Link to comment https://forums.phpfreaks.com/topic/150982-solved-phphtml-form/#findComment-793238 Share on other sites More sharing options...
trq Posted March 25, 2009 Share Posted March 25, 2009 You need to view tut10.html via your webserver, eg; http://localhost/tut10.html Link to comment https://forums.phpfreaks.com/topic/150982-solved-phphtml-form/#findComment-793246 Share on other sites More sharing options...
goosefrikin Posted March 25, 2009 Author Share Posted March 25, 2009 omg im a bloody retard anyways thanks alot guys Link to comment https://forums.phpfreaks.com/topic/150982-solved-phphtml-form/#findComment-793250 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.