Im trying to create a instant messaging service using php, im able to get the website up and running to register users to MySQL database but for the life of me i cant understand why it wont add the users
I have already made the table for the users in phpMyAdmin, also remade them just in case i messed it up but nothing works
This is my main webpage to register new users
<!doctype html>
<html>
<head>
<style>
*{margin:0px; padding:0px;}
#main{ width:200px; margin:24px auto; }
</style>
</head>
<body>
<?Php
require_once("connection.php") ;
if(isset($_POST['Register'])){
$first_name = $_POST['first_name'] ;
$last_name = $_POST['last_name'] ;
$user_name = $_POST['user_name'] ;
$password = $_POST['password'] ;
if ($first_name !="" and $last_name !="" and $user_name !="" and $password !="" ){
$q="INSERT INTO `user` ('id','first_name','last_name','user_name', 'password')
VALUES('', '".$first_name."', '".$last_name."', '".$user_name."', '".$password."')
" ;
if(mysqli_query($con, $q )){
header("location:login.php") ;
}else{
echo $q ;
}
}else{
echo "please fill in all the boxes" ;
}
}
?>
<div id="main">
<h2 align="center">Registration</h2>
<form method="post">
First Name:<br>
<input type="text" name="first_name" placeholder="First Name" />
<br><br>
Last Name:<br>
<input type="text" name="last_name" placeholder="Last Name" /><br><br>
User Name:<br>
<input type="text" name="user_name" placeholder="User Name" /><br><br>
Password:<br>
<input type="password" name="password" placeholder="Password" /><br><br>
<input type="submit" name"register" value="Register" />
</form>
</div>
</body>
</html>
It is referencing connection.php which is:
<?php
$con = mysqli_connect("localhost","pmauser","root","chat application") ;
?>
Once all the text has been entered and they click register, the form clears but no message pops up, after that i go to phpMyAdmin and check for users and it comes up empty, what should be happening is that it takes all the information in the textboxes and adds them to the data base.