prepare($sql); $stmt->execute([$name, $description]); } catch (PDOException $e) { // In a real app, log this error. For now, we'll just die. error_log("DB Error: " . $e->getMessage()); header('Location: index.php?error=dberror'); exit; } // Redirect back to the main page after successful insertion header('Location: index.php?success=processadded'); exit; } else { // If not a POST request, redirect to the main page header('Location: index.php'); exit; } ?>