I am stuck on inserting the data into mysql via php.

Its a foreach method and I am just stuck

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=\"checkbox\" name=\"choice[{$info['Que_ID']}.$i][]\" />{$info['Que_Choice'.$i]}<br />\n";   
 $intnumber++; } }?>
<input type="submit" value="submit" name="submit">

This is my form that can output the Question and its choices.

I am echoing this on to the next page, the code is shown below

<?PHPsession_start();
$name= $_SESSION['username1'];
echo "User ID: $name <br/>";
$gender = $_POST["choice"];
$que_ID = $_POST["Que_ID"];
foreach ($gender as $key => $array) {  	
if($array)	{ 
  $val=1; }  ///echo "Question ID and the choice ID:$key. Value is:.$val <br />\n"; $well = array(floor($key), substr(strstr($key, '.'), 1)); //$well = array(floor($key), $key - floor($key));

Now, instead of echoing. I just want to add this to mysql.

The layout of my sql is Que_ID, Ans_Choice1, Ans_Choice2, Ans_Choice3, Ans_Choice4, Use_ID

When I echo my php my outcome is

User ID: 2
Question ID= 1 Choice 1
Question ID= 2 Choice 3
Question ID= 3 Choice 4
Question ID= 4 Choice 1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.