Ok, in response to the several suggestions, my code has been changed somewhat. All the database code has been stripped from the <body>.
<?php require_once("_includes/db_connection.php"); ?>
<?php require_once("_includes/functions.php"); ?>
<?php
if (isset($_POST['add'])) {
$person = $_POST["person"];
$insert_query = "INSERT INTO 'people'('person') VALUES ('{$person}')";
$insert_result = mysqli_query($connection, $insert_query);
// Testing block
if ($insert_result) {
echo $insert_query . "<br />";
echo $person. "<br />";
echo $_POST["person"];
} else {
echo "FAIL!";
}
} elseif (isset($_POST['change'])) {
echo "You clicked change";
} elseif (isset($_POST['delete'])) {
echo "You clicked delete";
} else {
echo "FAIL";
}
$select_query = "SELECT * ";
$select_query .= "FROM people";
$select_result = mysqli_query($connection, $select_query);
if (!$select_result) {
die("Database query failed.");
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Edit People</title>
</head>
<body>
<form id="crud" name="crud" action="edit_list.php" method="post">
<?php
while($row = mysqli_fetch_assoc($select_result)) {
echo "<input type=\"text\" name=\"person\" value=\"{$row['person']}\">
<input type=\"submit\" name=\"change\" value=\"Change\">
<input type=\"submit\" name=\"delete\" value=\"Delete\"><br />";
}
echo "<input type=\"text\" name=\"person\" value=\"\"> <input type=\"submit\" name=\"add\" value=\"Add\"><br />";
?>
</form>
</body>
</html>
<?php mysqli_close($connection); ?>
Before I added the redirect test, when I typed a person's name into the blank text-box and click add, I got this result:
If I type that insert command into MySQL console, it creates a user with no errors. However, after I added the redirect test I get redirected to the failure page. For some reason, it seems that nothing is being sent to the database. I'm obviously reading from the database, and I've tried using root access to make sure that I had all the privileges. My head is getting squishy from banging it against the desk. Should I turn error reporting on in MySQL?