Hello everyone,
I'm creating a simpel survey tool'.
When people insert the question, they can also what kind of question type (checkbox or radiobutton)
Adding question and types in the mysql is oke..
I have a problem with showing the type & question
Problem: the questions only show if I remove the code if($row['question_type'] ..or remove type='.$type.
//db connection
$sql = mysqli_query($con, "SELECT `question`, `question_type` FROM `questions`");
while ($row = mysqli_fetch_assoc($sql))
if ($row['question_type'] = 1)
{
$type = "radio";
}
else {
$type ="checkbox";
}
// Associative array
{
echo '<form method="post" action="">';
echo '<tr>';
echo '<td>'. '<input type='.$type.' value= "'.$row['question'] . '" </td>';
echo '</form>';
mysqli_close($con);
?>
Thanks
Rem