-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete_recipe.php
27 lines (26 loc) · 1.03 KB
/
delete_recipe.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
session_start();
include 'variables.php';
include_once 'header.php';
if(isset($_GET['recipe_id'])){
$sqlRecipeQuery= 'SELECT * FROM recettes WHERE recpe_id = :recpe_id' ;
$recipeStatement = $db->prepare($sqlRecipeQuery);
$recipeStatement->execute(
['recpe_id' => $_GET['recipe_id'],]
)or die(print_r($db->errorInfo()));
$recipe = $recipeStatement->fetch();
}
?>
<?php if(isset($recipe)):?>
<?php if($recipe['author']==$_SESSION['logged_user']):?>
<h3 class="mt-4">Supprimer definitivement la recette : <?php echo($recipe['title'] . " (id : " . $recipe['recpe_id'].")") ?></h3>
<form action="./submit_delete_recipe.php" method="post">
<input type="hidden" name="recipe_id" value="<?php echo($recipe['recpe_id']);?>">
<button type="submit" class="btn btn-danger mb-3">Supprimer</button>
</form>
<?php else:?>
<p class="alert alert-warning mt-5">Vous ne pouvez pas éditer une recette qui n'est pas la vôtre</p>
<?php endif;
endif;
include_once 'footer.php';
?>