%PDF- %PDF-
Direktori : /home/medipszd/public_html/admin/ |
Current File : /home/medipszd/public_html/admin/category_edit.php |
<?php include 'includes/session.php'; if(isset($_POST['edit'])){ $id = $_POST['id']; $name = $_POST['name']; try{ $stmt = $conn->prepare("UPDATE category SET name=:name WHERE id=:id"); $stmt->execute(['name'=>$name, 'id'=>$id]); $_SESSION['success'] = 'Category updated successfully'; } catch(PDOException $e){ $_SESSION['error'] = $e->getMessage(); } $pdo->close(); } else{ $_SESSION['error'] = 'Fill up edit category form first'; } header('location: category.php'); ?>