I want to insert a record into the data-base, I don't know where's the probolem this is my code !
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$status = "";
$name = $_POST['name'];
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST[$password];
$query = "INSERT INTO admins (name, email, username, password) ";
$query .= "VALUES ('{$name}','{$email}','{$username}','{$password}')";
$result = mysqli_query($connect , $query);
if (isset($result)){
$status = "Admin has been added";
}else {
$status = "Admin hasn't been added ";
}
}
?>
<form action="add_user.php" method="post">
<h3>Name</h3>
<input name="name" placeholder="Name">
<h3>Username</h3>
<input name="username" placeholder="Username">
<h3>E-mail</h3>
<input name="email" placeholder="E-mail">
<h3>Password</h3>
<input name="password" placeholder="Password" id="password" type="password">
<h3>Confirm Password</h3>
<input name="confirm_pass" placeholder="Confirm Password" id="confirm_password" type="password" onkeydown="ValidatePass()">
<p id="pass_state"></p>
<div id="btn">
<input type="submit" value="Create User dis" disabled>
</div>
<h4 style="color: orangered"><?php ?></h4>
</form>
I know that there night be sqlInjections ! don't worry about that that's only for local development and learning purposes:D
please Help !