xxhK Posted August 19, 2013 Share Posted August 19, 2013 (edited) I Can't find out what is wrong with code.I'm a newbie to PHP and i created a form and embedded the script in the same page using if else statement. The Problem is that whenever i fill the form and then hit Submit button, the browser again asks me to fill the form instead of showing me the details i just entered. Below is The code. Please help me.. soon.. <html><head></head><body>Fill up this simple form to get started:<br/><?phpif(!isset($_POST['submit'])){?><form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"><p>Enter Your Name:</p><p><input type="text" name="name"></p><p>Select Your Age Group</p><p><select name="age"> <option>10-15</option> <option>16-20</option> <option>21-25</option></select></p><p>Comments</p><textarea name="comments" rows="5" cols="20">Your Comments Here..</textarea><br/><br/><input type="submit" value"Submit" name="Submit"></form><?php}else{ echo "YOU SUBMITTED THIS:<br/>"; $name=$_POST['name']; $age_grp=$_POST['age']; $comments=$_POST['comments']; echo "$name<br/>"; echo "$age_grp<br/>"; echo "$comments<br/>";}?></body></html> Edited August 19, 2013 by xxhK Quote Link to comment Share on other sites More sharing options...
xxhK Posted August 19, 2013 Author Share Posted August 19, 2013 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> echo : did this correction too in the code, but still no good. Quote Link to comment Share on other sites More sharing options...
PravinS Posted August 19, 2013 Share Posted August 19, 2013 (edited) your button name is "Submit" with capital "S" and while checking isset you are checking with small "s" as "submit", also assign values to each option in age drop down Edited August 19, 2013 by PravinS Quote Link to comment Share on other sites More sharing options...
xxhK Posted August 19, 2013 Author Share Posted August 19, 2013 Thank you so much Pravin S for your help. I greatly appreciate it. Once again, thanks a lot. Quote Link to comment Share on other sites More sharing options...
Barand Posted August 19, 2013 Share Posted August 19, 2013 xxhK, Tips for future posts: 1. Give posts a descriptive title, not just "Please help me". These forums are used by people searching for similar problems. 2. Use lower case - don't shout. 3. Use the <> button or code tags around your code. Quote Link to comment 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.