<?php
require("../inc/header.inc.php");
if(isset($_POST["username"])) {
$username = strip_tags($_POST["username"]);
$password = strip_tags($_POST["password"]);
$password2 = strip_tags($_POST["password2"]);
$email = strip_tags($_POST["email"]);
$joindate = date(Y-m-d);
if(!empty($_POST["firstname"])) {
$firstname = strip_tags($_POST["firstname"]);
}
else {
$firstname = "";
}
if(!empty($_POST["lastname"])) {
$lastname = strip_tags($_POST["lastname"]);
}
else {
$lastname = "";
}
if($password!=$password2) {
die("Your passwords don't match! Press your browsers back button to fix it.");
}
if(!strlen($username)> 21) {
die("Your username is too long! Press your browsers back button to fix it.");
}
if(strlen($password)< 7) {
die("Your password is too short! Press your browsers back button to fix it.");
}
else {
mysqli_query($con,"INSERT INTO users(`username`,`password`,`email`,`joindate`,`firstname`,`lastname`) VALUES ('$username','$password','$email,'$date','$firstname','$lastname')");
}
}
?>
I made this script today and it all seems to be running apart from the mysqli_query at the end. It doesn't run it. When I entered the valid data, it did what it's supposed to do - refresh the page and clear the inputs.
BUT - it doesn't insert the data. The my_sqli connection is fine, but that certain command doesn't work, any ideas why?