Я создал форму регистрации, используя php, и связал ее с моей базой данных. хотя в коде не обнаружено ошибок, оно не отображается в моей базе данных, пожалуйста, мне нужна помощь
<?php
$servername = "localhost";
$dBUsername ="seun";
$dBPassword ="Raji@3651";
$dBName ="signupsystem";
$conn = mysqli_connect($servername, $dBUsername, $dBPassword, $dBName);
if(!$conn){
die("connection failed:".mysqli_connect_error());
}
приведенный выше код предназначен для соединения, и я связал его с кодом ниже
<?php
if(isset($_POST['signup'])){
require 'dbh.inc.php';
$Email = $_POST['Email'];
$Password_1 = $_POST['Password_1'];
$Password_2 = $_POST['Password_2'];
$Firstname = $_POST['Firstname'];
$Lastname = $_POST['Lastname'];
$Mobile_number = $_POST['Mobile_number'];
$State = $_POST['State'];
$LGA = $_POST['LGA'];
if(empty($Email)|| empty($Password_1)|| empty($Password_2)|| empty($Firstname)|| empty($Lastname)|| empty($Mobile_number)|| empty($State)|| empty($LGA)){
header("location:../signup.php?error=emptyfields&Email=".$Email."&Firstname=".$Firstname."&Lastname=".$Lastname."&Mobile_number=".$Mobile_number."&State=".$State."&LGA=".$LGA);
exit();
}
elseif (!filter_var($Email, FILTER_VALIDATE_EMAIL)){
header("location:../signup.php?error=invalidEmail&Firstname=".$Firstname."&Lastname=".$Lastname."&Mobile_number=".$Mobile_number."&State=".$State."&LGA=".$LGA);
exit();
}
elseif (!preg_match("/^[a-zA-Z ]*$/", $Firstname)){
header("location:../signup.php?error=invalidFirstname&Email=".$Email."&Lastname=".$Lastname."&Mobile_number=".$Mobile_number."&State=".$State."&LGA=".$LGA);
exit();
}
elseif (!preg_match("/^[a-zA-Z]*$/", $Lastname)){
header("location:../signup.php?error=invalidLastname&Email=".$Email."&Firstname=".$Firstname."&Mobile_number=".$Mobile_number."&State=".$State."&LGA=".$LGA);
exit();
}
elseif (!preg_match("/^[0-9]*$/", $Mobile_number)){
header("location:../signup.php?error=invalidmobile_number&Email=".$Email."&Firstname=".$Firstname."&Lastname=".$Lastname."&State=".$State."&LGA=".$LGA);
exit();
}
elseif (!preg_match("/^[a-zA-Z]*$/", $LGA)){
header("location:../signup.php?error=invalidLGA&Email=".$Email."&Firstname=".$Firstname."&Lastname=".$Lastname."&Mobile_number=".$Mobile_number."&State=".$State);
exit();
}
elseif($Password_1 !==$Password_2){
header("location:../signup.php?error=Passwordcheck&Email=".$Email."&Firstname=".$Firstname."&Lastname=".$Lastname."&Mobile_number=".$Mobile_number."&State=".$State."&LGA=".$LGA);
exit();
}
else{
$sql = "SELECT Emailuser FROM users WHERE Emailuser=?";
$stmt = mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt, $sql)){
header("location:../signup.php?error=sqlerror");
exit();
}
else{
mysqli_stmt_bind_param($stmt, "s", $Email);
mysqli_stmt_execute($stmt);
mysqli_stmt_store_result($stmt);
$resultcheck = mysqli_stmt_num_rows($stmt);
if($resultcheck > 0){
header("location:../signup.php?error=emailtaken&Firstname=".$Firstname."&Lastname=".$Lastname."&Mobile_number=".$Mobile_number."&State=".$State."&LGA=".$LGA);
exit();
}
else{
$sql = "INSERT INTO users (Emailuser, Passworduser, Firstnameuser, Lastnameuser, Mobile_nouser, Stateuser, LGAuser) VALUES ('$Email', '$Password_1', '$Firstname', '$Lastname', '$Mobile_number', '$State', '$LGA')";
$stmt = mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt, $sql)){
header("location:../signup.php?error=sqlerror111");
exit();
}
else{
mysqli_stmt_bind_param($stmt, "ssssiss", $Email, $Password_1, $Firstname, $Lastname, $Mobile_number, $State, $LGA);
mysqli_stmt_execute($stmt);
header("location:../signup.php?signup=success");
exit();
}
}
}
}
mysqli_stmt_close($stmt);
mysqli_close($conn);
}
в коде нет ошибок, но он не публикуется в моей базе данных
я использую apache 24 mysqli workbench phpmyadmin