I literally have no idea why this isn't working. I am trying to make a simple ban log system where I can manually log all of the bans I have inputted for each day and add notes about the ban. I am trying to make the code check for notes and if there are no notes, it will print that there are none and send it through to the database. I have over complicated the code just to make sure it works correctly, but, it still won't work.
The form's HTML:
insert.php:
What it's outputting when I put no notes:
Thanks for the help.
The form's HTML:
HTML:
<form action="insert.php" method="post">
Username<br>
<input name="name" type="text" title="What was the user's name?"><br>
Reason<br>
<input name="reason" type="text" title="Why did you ban them?"><br>
Notes<br>
<input name="notes" type="text" title="Any notes?"><br>
<input type="submit">
</form>
PHP:
<?php $notes = $_POST['notes'];
$checkfornotes = false;
if(!empty($notes)){
$checkfornotes = true;
}else{
$checkfornotes = false;
}
echo "Your ban for " . $_POST['name'] . " has been added.";
echo "<br/><br/>";
echo "You banned " . $_POST['name'] . " for: " . $_POST['reason'];
echo "<br/><br/>";
if($checkfornotes = true){
echo "You also put:<br/><br/>" . $_POST['notes'];
}elseif($checkfornotes = false){
echo "You didn't put any notes in!";
}else{
echo "LOLWTFHAPPENED";
}
?>
Thanks for the help.