MjM8082 Posted August 23, 2011 Share Posted August 23, 2011 Have never done this before, but I'm sure many of you have. What I am trying to do is take the information that the user fills out in this form and when they hit submit, it will be displayed into a html table on the next page. I don't need someone to do the entire table for me, just looking for some help to get started and a general idea of what to do. Here is my code for my form that I have created... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Lab 4</title> </head> <body> <?php ?> <form method="POST" action="lab4form.php"> <label for="first_name">First Name:</label> <input type="text" id="first_name" name="first_name" /><br /> <label for="last_name">Last Name:</label> <input type="text" id="last_name" name="last_name" /><br /> <label for="coverage_amount">Coverage Amount:</label> <input type="text" id="coverage_amount" name="coverage_amount" /><br /> <label for="gender">Gender:</label> <br> <input id="male" type="radio" value="radiobutton" name="male" /> <label for="male">Male</label> <input id="female" type="radio" value="radiobutton" name="female" /> <label for="female">Female</label> <br /> <br> <label for="Age">Age:</label> <input type="text" id="age" name="age" /><br /> <br> <label for="health">Health Conditions</label> <br /> <input type="checkbox" name="health" value="heart" /> <label for="health">Heart Disease</label><br /> <input type="checkbox" name="health" value="diabetes" /> <label for="health">Diabetes</label><br /> <input type="checkbox" name="health" value="blood" /> <label for="health">High Blood Pressure</label><br /> <input type="checkbox" name="health" value="Smoker" /> <label for="health">Smoker</label><br /> <input type="checkbox" name="health" value="lung" /> <label for="health">Lung disease</label><br /> <FORM METHOD=POST ACTION="lab4form.php"> <P>Employment Status<BR> <SELECT NAME="employment"> <OPTION VALUE="lab4form.php">Unemployed <OPTION VALUE="lab4form.php">Full-Time <OPTION VALUE="lab4form.php">Part-Time <OPTION VALUE="lab4form.php">Student </SELECT><br /> <br> <label for="comments">Comments</label> <input type="text" id="comments" name="comments"/><br /> <br> <input type="submit" value="Add User" name="btn_add" /> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/245473-how-to-put-form-information-into-a-html-table/ Share on other sites More sharing options...
doddsey_65 Posted August 23, 2011 Share Posted August 23, 2011 in your next page use something like <table> <tbody> <tr> <td> <?php echo $_POST['first_name']; ?> </td> the rest should be self explanitory. Link to comment https://forums.phpfreaks.com/topic/245473-how-to-put-form-information-into-a-html-table/#findComment-1260778 Share on other sites More sharing options...
MjM8082 Posted August 23, 2011 Author Share Posted August 23, 2011 Thank you, and when I get to something like.. The check boxes and radio buttons on the form, how do I get those to display on the table? For example... Gender on the form is selected by a radio button. How would I get the correct radio button that is click on to display on the next page on the table? Link to comment https://forums.phpfreaks.com/topic/245473-how-to-put-form-information-into-a-html-table/#findComment-1260790 Share on other sites More sharing options...
WebStyles Posted August 23, 2011 Share Posted August 23, 2011 same thing: <input type="radio" name="gender" value="Male" /> <input type="radio" name="gender" value="Female" /> On the next page, use: echo $_POST['gender']; Link to comment https://forums.phpfreaks.com/topic/245473-how-to-put-form-information-into-a-html-table/#findComment-1260856 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.