currently I have a survey with 10 questions on a html/ php form. I use post data and then have a long insert statment. My code looks something like this.
<php?
$surveyid = $_POST['surveyid'];
$q1 = $_POST['q1'];
$q1comments = $_POST['q1comments'];
$q2 = $_POST['q2'];
$q2comments = $_POST['q2comments'];
$q3 = $_POST['q3'];
$q3comments = $_POST['q3comments'];
$query "insert into survey(surveyid,q1,q1comments,q2,q2comments,q3,q3comments)
$parms1 = array($surveyid,$q1,$q1comments,$q2,$q2comments ..
$results = sqlsrv_query($conn,$query,$parms1);
I'm trying to use a for loop but I can't quite get it right;
foreach (question as $question )
{
$query = "INSERT INTO safteyudit(auditid,questions,comment,issue) VALUES('$auditid','$question','$comments') ";
$parms1 = array($auditid,$question,$comments,$issue);
$query = sqlsrv_query($conn,$query,$parms1);
}