furrls 0 Newbie Poster
$qID = '';
$question = 'Question not set';
$answerA = 'unchecked';
$answerB = 'unchecked';
$answerC = 'unchecked';
$answerD = 'unchecked';
$answerE = 'unchecked';



?>

<html>
<head>
<script type="text/javascript">
function show_alert()
{
alert("Please Click OK to proceed!");
                  
}
</script>
</head>
<form action="Process1.php" method="POST">
<table>
<tr>
<td>
<?php 

$SQL = "SELECT stu_satisfaction_tblquestions.question_id, stu_satisfaction_tblquestions.question, answer_type.answer1, answer_type.answer2, answer_type.answer3, answer_type.answer4, answer_type.answer5 FROM stu_satisfaction_tblquestions INNER JOIN answer_type ON stu_satisfaction_tblquestions.answers_id=answer_type.answers_id
";
$result = mysql_query($SQL);
while($db_field = mysql_fetch_assoc($result)){ 

	$qID = $db_field['question_id'];
	$question = $db_field['question'];
	$A = $db_field['answer1'];
	$B = $db_field['answer2'];
	$C = $db_field['answer3'];
	$D = $db_field['answer4'];
	$E = $db_field['answer5'];
	print $question;
?>
</td>
</tr>
<tr>
<td>
<INPUT TYPE = 'Radio' Name ='q'  value= 'A' <?PHP echo $answerA; ?>><?PHP echo $A; ?>
<INPUT TYPE = "Hidden" Name = "h"  VALUE = <?PHP print $qID; ?>>
<?php echo $qID;?>
</td>
</tr>
<tr>
<td>
<INPUT TYPE = 'Radio' Name ='q'  value= 'B' <?PHP echo $answerB; ?>><?PHP echo $B; ?>
<?php echo $qID;?>
</tr>
</td>
<tr>
<td>
<INPUT TYPE = 'Radio' Name ='q'  value= 'C' <?PHP echo $answerC; ?>><?PHP echo $C; ?>
</tr>
</td>
<tr>
<td>
<INPUT TYPE = 'Radio' Name ='q'  value= 'D' <?PHP echo $answerD; ?>><?PHP echo $D; ?>
</tr>
</td>
<tr>
<td>
<INPUT TYPE = 'Radio' Name ='q'  value= 'E' <?PHP echo $answerE; ?>><?PHP echo $E; ?>
<br>
<?php }  mysql_close(); ?>
</tr>
</td>
<tr>
<td>


Please add any comments you may have:</br>
 <textarea rows="3" cols="60" name="comments" id="comments">
 </textarea>

</td>
</tr>


</table>

<input type="submit" onclick="show_alert()" value="Submit" />
</form>

</html>

Error getting the correct question ID and only retrieve one question ID in the process part.I have 20 questions in my database now, instead of getting QID of 1 for the 1st question, im got QID of 20 and i only managed to retrieve 1 result instead of 20 result in the process page.So how do i retrieve all the result that i input and process it in the process page, i'm currently working on a survey.

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.