#1
Posted 11 May 2016 - 10:16 PM
#2
Posted 12 May 2016 - 01:21 AM
Hey there Panda and welcome to Geeks to Go,
Please excuse me, but what is your question? Like what is the problem exactly? I haven't been through the code yet, but if you can be a little more specific about the issue you're experiencing, I'm sure we can help!
Peace Out
#3
Posted 12 May 2016 - 01:27 AM
i have five radio buttons for each of the ten questions. how do i insert which radio button is selected by a user for each question in the database. one row should have the ID and ten answers for ten questions for one user. i want such multiple column entries for multiple users.
#4
Posted 12 May 2016 - 07:59 AM
<form method="post">
<form method="post" action="somescript.php">
#5
Posted 12 May 2016 - 10:50 PM
Thanks a lot.I could connect to the php form and then to the database. But only the first answer is getting saved into the database and all the other values are showing zero. Can u suggest something. i have created one id auto inc table and ten tables to store ten answers
Edited by panda123, 13 May 2016 - 12:45 AM.
#6
Posted 13 May 2016 - 09:59 AM
Actually, the second time you run it, it may give errors anyway as the tables will already exist.
Your INSERT statement should be in your somescript.php file (that I suggested in my earlier post) and you're not picking the values from your form up.
$sql = "INSERT INTO survey (sid, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10,) VALUES (' ', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?')"; if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . $conn->error; }You're not picking the values for q1, q2, ... q10 up from $_POST, binding your parameters and then executing it.
http://www.w3schools..._statements.asp
Incidentally, you have a lot of straight-line code that might become difficult to maintain. You may do better using more loops.
Similar Topics
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users