<!--- 

Developer: Coralys Cubero Rivera
Fall 2018

The program displays a table listing all the subquestionnaires that are saved in our system. 
It gives the user the ability to add more and to delete whichever one he doesn't want. 



Updated by: Víctor A. Hernández
Summer 2019

--->


<?php 
	require_once 'processes/config.php';
	require_once 'processes/dbh.inc.php';
	include_once 'header.php';
?>

		<!-- Subquestionnaires -->
    	<div class='container'>
			<br>
			<h3>SUB-QUESTIONNAIRES</h3>
			<br>
        	<a class='btn btn-info' href='newSubquestionnaire.php' style='color:white'><b> New Subquestionnaire </b></a>
        	<br><br>
			<table class='table table-hover' id='tableEvaluations'>
      			<?php
      				$query = "SELECT * FROM `subquestionnair`;";
      				$result = mysqli_query($connection, $query);
     			 	echo "
					<thead>
						<tr>
							<th> ID </th>
							<th> Title </th>
							<th> Description </th>
						</tr>
					</thead>
					<tbody>";
					while($row = mysqli_fetch_array($result)) {
						echo "<tr>";
						echo "<td> <p> ".$row['id']." </p> </td>";
						echo "<td> <p> ".$row['title']." </p> </td>";
						echo "<td> <p> ".$row['description']." </p> </td>";
						echo '<td> <a href="viewSubquestionnaire.php?view='.$row['id'].'"> <b> View </b> </a> </td>';
						echo "<td> <a href='confirmDeleteSubquestionnaire.php?del=".$row['id']."'> <b> Delete </b> </a> </td>";
						echo "</tr>";
					}
					echo "</tbody>"
				?>
      		</table>
      	</div>
	
<?php
	include_once 'footer.html';
?>