A Simple Login Form developed in PHP and MYSQL with HTML5 Form validation.
It checks if the username , email and password is valid or not
if (empty($name)) {
$errorname = "write a valid name you piece of shit";
} else {
if (!preg_match("/^[a-zA-Z-' ]*$/", $name)) {
$errorname = "are you kid of elon musk";
} else {
$count = $count + 1;
}
}
If all the validation are successful then it connect to your server
It use local xampp server and fetch the data directly to database.
$conn = mysqli_connect($servername, $username, $password);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
- If the database or table is already created then it will show error.
echo "error : Database is not connected";
echo "Error: " . $sql . "" . mysqli_error($connection);
- If it show error try changing database name.
$sql = "CREATE DATABASE myDB";