In my project, I have 3 tables - Survey, survey Questions, Survey options. In the survey table, it stores the survey names. In survey questions table store the questions to the respective survey. In the survey options table store the options of each question. Now I've displayed the survey names in a table. Here my problem is, When I click any survey name, it should display the corresponding questions of survey and options of that questions. for example, in the page, the survey names displayed like below 1. ABC survey 2. ERG survey
When I click on the ABC survey, it should display all questions and options related to that survey. I'm new to PHP coding. I'm using PHP, MySQL with XAMPP server. I did up to display the survey names.Below is my code
<tr><th>Name</th><th>Created Date</th><th>Status</th></tr>
<?php
$sql=mysqli_query($connection,"select * from survey");
if(mysqli_num_rows($sql)==0)
{
echo "No records to display";
}
else {
while($row=mysqli_fetch_array($sql)) {
echo "<tr><td><a href='surveydetails.php' name='selected_survey_$i'
id='selected_survey'>".$row['survey_name']."</td><td>" .$row['created_date']
."</td>"; echo "<td>";
if($row['status']==1){
echo "<select name='status'>
<option value='1' selected='selected'>Active</option>
<option value='0'>Inactive</option>
</select>";
}
else{
echo "<select name='status'>
<option value='1'>Active</option>
<option value='0' selected='selected'>Inactive</option></select>";
}
echo "</td></tr>";
$i++;
}
}
?>