Hey
I can print choice in loop but how do I print Question ID for the choices.
For example: Question ID= 2
choice 1= whatever
choice 2= whatever
choice 3= whatever
choice 4= whatever
Question ID= 3
choice 1= whatever
choice 2= whatever
choice 3= whatever
choice 4= whatever
for Now I can print
choice1 = whatever
choice2 = whatever
chocie3 = whatever
choice4 = whatever
choice5 = whatever
chocie5 = whatever
and so on
but I was to print question ID for four choices that are shown on my form
<html>
<head>
<?php
session_start();
include '../Database/connection.php';
//$_SESSION['smodule'];
?>
<title>Personal INFO</title>
</head>
<body>
<form method="post" action="radio1.php">
<?PHP
include '../Database/take_an_exam.php';
$intNum = 1;
$intnumber = 1;
while( $info = mysql_fetch_array( $sqll )){
echo "<input type='hidden' name=\"Que_ID\" value=\"{$info['Que_ID']}\" /> ";
echo " $intNum, {$info['Que_Question']} <br />\n";
$intNum++;
for ($i =1; $i < 5; $i++) {
echo "<input type=\"Radio\" name=\"choice[{$intnumber}][]\" />{$info['Que_Choice'.$i]}<br />\n";
$intnumber++;
}
}
?>
<input type="submit" value="submit" name="submit">
</form>
The above code shows the form
the below code shows the action
<?php
//$gender = $_POST["choice"];
//foreach($_POST["Que_ID"] as $que_ID){
$que_ID = $_POST["Que_ID"];
//echo $que_ID;}
//foreach ($gender as $key => $value) {
foreach ($_POST["choice"] as $question => $answer)
{
if($answer == "")
{ $val=0;
}else{
$val = 1;
}
echo "Choice ID: $que_ID .$question. $val<br />";
}
//echo $que_ID. $key." - ".$value."";}
?>
can someone please help me.