wahlhelfer/admin/view-questions.php
2014-05-15 18:49:45 +02:00

76 lines
2.4 KiB
PHP

<?php
include('../config/config.php');
include(ADMIN_HTML.'html.inc.php');
include(ADMIN_INCLUDES.'functions.php');
checkLoginAdmin();
if ( isset($_GET['quest']) && !empty($_GET['quest']) )
{
mysql_query("DELETE FROM tbl_questions WHERE Id = '".clean(base64_decode($_GET['quest']))."'");
$redirectUrl = 'view-questions.php';
$_SESSION['succesMessage'] = 6;
header("Location: $redirectUrl");
exit;
}
startHtml($title = "View Questions");
tophead($title);
leftNav();
?>
<?php
if ( isset($_SESSION['succesMessage']) )
{
successMsg($_SESSION['succesMessage']);
unset($_SESSION['succesMessage']);
}
?>
<section id="main" class="column">
<article class="module width_full">
<header>
<h3 class="tabs_involved">Questions Management</h3>
<ul class="tabs">
<li class="active"><a href="<?php echo ADMIN_URL;?>add-question.php">Add Record</a></li>
</ul>
</header>
<table class="display data-table" id="myTable">
<thead>
<tr>
<th width="50">Rec.#</th>
<th width="250">Title</th>
<th>Question</th>
<th width="60">Action</th>
</tr>
</thead>
<tbody>
<?php
$getRes = mysql_query("SELECT Id, Heading, Question FROM tbl_questions ORDER BY Id DESC");
$count = 1;
while( $row = mysql_fetch_array($getRes) )
{
?>
<tr>
<td align="right"><?php echo $count;?></td>
<td align="center"><?php echo $row['Heading'];?></td>
<td align="left"><?php echo nl2br($row['Question']);?></td>
<td align="center">
<a href="<?php ADMIN_URL;?>edit-question.php?quest=<?php echo base64_encode($row['Id']);?>"><img src="images/icn_edit.png" /></a>
|
<a href="<?php ADMIN_URL;?>view-questions.php?quest=<?php echo base64_encode($row['Id']);?>"><img src="images/icn_trash.png" onclick="return confirm('Are you sure you want to delete the selected record?')" /></a>
</td>
</tr>
<?php
$count++;
}
?>
</tbody>
</table>
</article>
<div class="spacer"></div>
</section>
<?php
endHtml();
?>