silverglade Posted January 17, 2010 Share Posted January 17, 2010 i cant make this bullet choices form to work, it doesnt add the "good" "ok" variables to the database. any help greatly appreciated. thanks. derek here is the code. <?php include("connect1.php"); //////////////////////////////////////// //////////////////////////////////////// /// query db and loop through rows example $id = $_POST['id']; $field2 = $_POST['friend']; $field3 = $_POST['zip']; $field4 = $_POST['loyalty']; $field5 = $_POST['courtesy']; $field6 = $_POST['stability']; $field7 = $_POST['attitude']; mysql_query("INSERT INTO friendgrade (friend,zip,loyalty,courtesy , stability, attitude)VALUES('$field2','$field3','$field4','$field5','$field6' , '$field7')"); ?> <!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> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Update Statement</title> <style type="text/css"> <!-- .style1 {color: #990000} .style2 {color: #0066FF} .style3 {color: #0000CC} .style4 {color: #993399} --> </style> </head> <body> </p> <p><span class="style2">*If updating a row, please enter the ID of the row you want to update, and enter the data</span><br /> <br /> <span class="style3">*If adding a new row of data , just leave the ID space blank</span><br /> <br /> <span class="style4">*To delete a row of data, click on the id of the row to delete</span><br /> </p> <form id="form1" name="form1" method="post" action=""> <table width="90%" border="0"> <tr> <td>ID</td> <td><input name="id" type="text" id="id" /></td> </tr> <tr> <td>Friend</td> <td> <input name="friend" type="text" id="friend" /></td> </tr> <tr> <td width="32%">zip code</td> <td width="68%"> <input name="zip" type="text" id="zip" /> </td> </tr> <tr> <td>courtesy</td> <td><table width="345"> <tr> <td width="337"><label> <input type="radio" name="RadioGroup1" value="very poor" id="RadioGroup1_0" /> very poor <input type="radio" name="RadioGroup1" value="poor" id="RadioGroup1_1" /> poor <input type="radio" name="RadioGroup1" value="ok" id="RadioGroup1_2" /> ok <input type="radio" name="RadioGroup1" value="good" id="RadioGroup1_3" /> good <input type="radio" name="RadioGroup1" value="excellent" id="RadioGroup1_4" /> excellent </label></td> </tr> </table> </td> </tr> <tr> <td>stability</td> <td><input type="radio" name="grade2" id="very_poor3" value="very_poor" /> very poor <input type="radio" name="grade2" id="poor3" value="poor" /> poor <input type="radio" name="grade2" id="ok3" value="ok" /> ok <input type="radio" name="grade2" id="good3" value="good" /> good <input type="radio" name="grade2" id="excellent3" value="excellent" /> excellent</td> </tr> <tr> <td>loyalty</td> <td><input type="radio" name="grade3" id="very_poor4" value="very_poor" /> very poor <input type="radio" name="grade3" id="poor4" value="poor" /> poor <input type="radio" name="grade3" id="ok4" value="ok" /> ok <input type="radio" name="grade3" id="good4" value="good" /> good <input type="radio" name="grade3" id="excellent4" value="excellent" /> excellent</td> </tr> <tr> <td>attitude</td> <td><input type="radio" name="grade4" id="very_poor5" value="very_poor" /> very poor <input type="radio" name="grade4" id="poor5" value="poor" /> poor <input type="radio" name="grade4" id="ok5" value="ok" /> ok <input type="radio" name="grade4" id="good5" value="good" /> good <input type="radio" name="grade4" id="excellent5" value="excellent" /> excellent</td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Submit" /></td> </tr> </table> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/188771-i-cant-make-a-bullet-choices-form-to-work/ Share on other sites More sharing options...
silverglade Posted January 17, 2010 Author Share Posted January 17, 2010 here is the new code, still doesnt update the table <?php include("connect1.php"); //////////////////////////////////////// //////////////////////////////////////// /// query db and loop through rows example $id = $_POST['id']; $field2 = $_POST['friend']; $field3 = $_POST['zip']; $field4 = $_POST['loyalty']; $field5 = $_POST['courtesy']; $field6 = $_POST['stability']; $field7 = $_POST['attitude']; mysql_query("INSERT INTO friendgrade (friend,zip,loyalty,courtesy , stability, attitude)VALUES('$field2','$field3','$field4','$field5','$field6' , '$field7')"); ?> <!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> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Update Statement</title> <style type="text/css"> <!-- .style1 {color: #990000} .style2 {color: #0066FF} .style3 {color: #0000CC} .style4 {color: #993399} --> </style> </head> <body> </p> <p><span class="style2">*If updating a row, please enter the ID of the row you want to update, and enter the data</span><br /> <br /> <span class="style3">*If adding a new row of data , just leave the ID space blank</span><br /> <br /> <span class="style4">*To delete a row of data, click on the id of the row to delete</span><br /> </p> <form id="form1" name="form1" method="post" action=""> <table width="90%" border="0"> <tr> <td>ID</td> <td><input name="id" type="text" id="id" /></td> </tr> <tr> <td>Friend</td> <td> <input name="friend" type="text" id="friend" /></td> </tr> <tr> <td width="32%">zip code</td> <td width="68%"> <input name="zip" type="text" id="zip" /> </td> </tr> <tr> <td>courtesy</td> <td> <input type="radio" name="group1" value="very_poor">very poor <input type="radio" name="group1" value="poor" checked> poor <input type="radio" name="group1" value="ok"> ok <input type="radio" name="group1" value="good"> good <input type="radio" name="group1" value="excellent"> excellent </td> </tr> <input type="radio" name="group1" value="very_poor">very poor <input type="radio" name="group1" value="poor" checked> poor <input type="radio" name="group1" value="ok"> ok <input type="radio" name="group1" value="good"> good <input type="radio" name="group1" value="excellent"> excellent </td> </tr> <tr> <td>stability</td> <td><input type="radio" name="group1" value="very_poor">very poor <input type="radio" name="group1" value="poor" checked> poor <input type="radio" name="group1" value="ok"> ok <input type="radio" name="group1" value="good"> good <input type="radio" name="group1" value="excellent"> excellent</td> </tr> <tr> <td>loyalty</td> <td><input type="radio" name="group1" value="very_poor">very poor <input type="radio" name="group1" value="poor" checked> poor <input type="radio" name="group1" value="ok"> ok <input type="radio" name="group1" value="good"> good <input type="radio" name="group1" value="excellent"> excellent</td> </tr> <tr> <td>attitude</td> <td><input type="radio" name="group1" value="very_poor">very poor <input type="radio" name="group1" value="poor" checked> poor <input type="radio" name="group1" value="ok"> ok <input type="radio" name="group1" value="good"> good <input type="radio" name="group1" value="excellent"> excellent</td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Submit" /></td> </tr> </table> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/188771-i-cant-make-a-bullet-choices-form-to-work/#findComment-996604 Share on other sites More sharing options...
silverglade Posted January 17, 2010 Author Share Posted January 17, 2010 nevermind thanks i got it to work with the following code. <?php include("connect1.php"); //////////////////////////////////////// //////////////////////////////////////// /// query db and loop through rows example $id = $_POST['id']; $field2 = $_POST['friend']; $field3 = $_POST['zip']; $field4 = $_POST['grade1']; $field5 = $_POST['grade2']; $field6 = $_POST['grade3']; $field7 = $_POST['grade4']; mysql_query("INSERT INTO friendgrade (friend,zip,loyalty,courtesy , stability, attitude)VALUES('$field2','$field3','$field4','$field5','$field6' , '$field7')"); ?> <!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> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Update Statement</title> <style type="text/css"> <!-- .style1 {color: #990000} .style2 {color: #0066FF} .style3 {color: #0000CC} .style4 {color: #993399} --> </style> </head> <body> </p> <div align="center">WELCOME TO THE FRIENDGRADER</div> <p>Please enter a friend, their zip code, and rate them with the following criteria.<span class="style4"></span><br /> </p> <form id="form1" name="form1" method="post" action=""> <table width="90%" border="0"> <tr> <td>Friend</td> <td> <input name="friend" type="text" id="friend" /></td> </tr> <tr> <td width="32%">zip code</td> <td width="68%"> <input name="zip" type="text" id="zip" /> </td> </tr> <tr> <td>courtesy</td> <td><table width="345"> <tr> <td width="337"><label> <input type="radio" name="grade1" value="very poor" id="RadioGroup1_0" /> very poor <input type="radio" name="grade1" value="poor" id="RadioGroup1_1" /> poor <input type="radio" name="grade1" value="ok" id="RadioGroup1_2" /> ok <input type="radio" name="grade1" value="good" id="RadioGroup1_3" /> good <input type="radio" name="grade1" value="excellent" id="RadioGroup1_4" /> excellent </label></td> </tr> </table> </td> </tr> <tr> <td>stability</td> <td><input type="radio" name="grade2" id="very_poor3" value="very_poor" /> very poor <input type="radio" name="grade2" id="poor3" value="poor" /> poor <input type="radio" name="grade2" id="ok3" value="ok" /> ok <input type="radio" name="grade2" id="good3" value="good" /> good <input type="radio" name="grade2" id="excellent3" value="excellent" /> excellent</td> </tr> <tr> <td>loyalty</td> <td><input type="radio" name="grade3" id="very_poor4" value="very_poor" /> very poor <input type="radio" name="grade3" id="poor4" value="poor" /> poor <input type="radio" name="grade3" id="ok4" value="ok" /> ok <input type="radio" name="grade3" id="good4" value="good" /> good <input type="radio" name="grade3" id="excellent4" value="excellent" /> excellent</td> </tr> <tr> <td>attitude</td> <td><input type="radio" name="grade4" id="very_poor5" value="very_poor" /> very poor <input type="radio" name="grade4" id="poor5" value="poor" /> poor <input type="radio" name="grade4" id="ok5" value="ok" /> ok <input type="radio" name="grade4" id="good5" value="good" /> good <input type="radio" name="grade4" id="excellent5" value="excellent" /> excellent</td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Submit" /></td> </tr> </table> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/188771-i-cant-make-a-bullet-choices-form-to-work/#findComment-996637 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.