im working on this script and so far so good.
now i want to turn what i have into a a loop where it loops the insert statement.
in the comments is where i am starting my loop.
now what i have trouble with is this bit:
Code: Select all
$s_id = $_POSTї"s_id"];
$q_no = $_POSTї"q_1"];
$r_text = $_POSTї"txt_answer_0"];
$r_radio = $_POSTї"radio_0"];but the q_no will go: q_1, q_2, q_3
r_text will go: txt_answer_0, txt_answer_1, txt_answer_2
r_radio will go: radio_0, radio_1, radio_2
how can i dynamically have this change?
has what i have written made sense?
in the example below i have hardcoded the vaules in for ONE insert.
thanx
Code: Select all
<?php
session_start();
ob_start();
include("conection.php");
if ($_SERVERї'REQUEST_METHOD'] == "POST")
{
$s_id = $_POSTї"s_id"];
$q_no = $_POSTї"q_1"];
$r_text = $_POSTї"txt_answer_0"];
$r_radio = $_POSTї"radio_0"];
## for ($i=0; $i <$num_results; $i++)
## {
## $sql = "INSERT INTO tbl_results (s_id,q_no,r_text,r_radio)
##VALUES ('$s_id','$q_no','$r_text','$r_radio')";
## $result = mysql_query($sql) or die
##("Execution failed: ".mysql_error());
## }
echo"s_id: $s_id <br />";
echo"q_no: $q_no <br />";
echo"r_text: $r_text <br />";
echo"r_radio: $r_radio <br />";
}
?>