I am having trouble passing my form data to my database. Config.php is correct, table reads and displays correctly; just can't for the life of me get this to work. Also, I do not do this as an occupation (obviously) just trying to learn.
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_POST['type']) && isset($_POST['client']) && isset($_POST['contact']) &&
isset($_POST['name']) && isset($_POST['date']) && isset($_POST['po']) && isset($_POST['notes'])) {
$sql = "INSERT INTO list (type, client, contact, name, date, po, notes) VALUES (?,?,?,?,?,?,?)";
if ($stmt = $link->prepare($sql)) {
$stmt->bind_param("ssi", $_POST['type'], $_POST['client'], $_POST['contact'], $_POST['name'],
$_POST['date'], $_POST['po'], $_POST['notes']);
if ($stmt->execute()) {
header("location: index.php");
exit();
} else {
echo "ERROR! Please Try Again...";
}
$stmt->close();
}
}
$link->close();
}
?>
If it turns out to be a syntax issue; I will hang my head.