all.
I have a project with a table (code below). In the last column I have a 'delete' href that leads to a php page with code below. For a reason the header('location: ') does not work. The rest of the page does work fine.
The table is a part of my index page. Is this the problem? When i use the same line on other pages it works just fine.
Any suggestions here?
Tnx
table-body:
<tbody>
<?php
foreach($todo as $todos){
echo"<tr>";
echo"<td>".$todos['title']."</td>";
echo"<td>".$todos['description']."</td>";
echo"<td>".$todos['categorie']."</td>";
echo "<td><a href=account.php?page=editTodo".$todos['id']."><i class='fa fa-fw fa-edit'></i></a></td>";
echo "<td><a href=account.php?page=delTodo".$todos['id']."><i class='fa fa-fw fa-trash'></i></a></td>";
echo "</tr>";
}
?>
</tbody>
php page:
<?php
$var_value = $_SESSION['varname'];
if (isset($_SESSION['varname'])){
$id = $_SESSION['varname'];
$sql = "DELETE FROM todo WHERE id = '$id'";
$query = $conn->prepare( $sql );
if ($query == false) {
print_r($conn->errorInfo());
die ('Erreur prepare');
}
$sth = $query->execute();
if ($sth == false) {
print_r($query->errorInfo());
die ('Erreur execute');
}
}
header('Location: http://localhost:8888/CasinoAPP/admin/index.php');
?>