Hello everyone, im trying to make a registration system with PHP and MySQL but im not going well i just created table and i have writed the code well but there is something wrong the inputs don't send that data into database i have tryed much different ways of doing it but still cant be posted nothing in to database. Here is the code:
<form method='post'>
Name: <input type="text" name="name" color='#4DFF4D' placeholder='Your Real Name' /><br>
Last Name: <input type="text" name="lastname" color='#4DFF4D' placeholder='Your last name' /><br>
Username: <input type="text" name="username" color='#4DFF4D' placeholder='Choose Username' /><br>
Password: <input type="password" name="password" color='#4DFF4D' placeholder='Choose Password' /></font>
<input style="border-radius:8px;" type="image" class="new_account" name="submitb" src="NewAccount.png" alt="NewAccount" height='50' width='250px'>
</form>
<?php
if(isset($_POST['name']))
{
$con=mysqli_connect("$mysql_host","$mysql_database","$mysql_password ","$mysql_user ");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: ".mysqli_connect_error();
}
$sql="INSERT INTO Members (Name, Lastname, Username, Password)
VALUES
('$_POST[name]','$_POST[lastname]','$_POST[username]','$_POST[password]')";
if (!mysqli_query($con,$sql))
{
die('Error: '.mysqli_error($con));
}
mysqli_close($con);
}
?>
Thank you for helping me !