Что не так с моим кодом он не показывает
<?php include('connection.php'); $error = ""; if (isset($_POST['register'])) { $name = $_POST['name']; $email = $_POST['email']; $password = $_POST['password']; echo $name; echo $email; echo $password; $query = "INSERT INTO users(name, email, password) VALUES('$name','$email','$password')"; $results = mysqli_query($conn,$query); if ($results) { $error ="you are registered"; header('location: login.php'); } else { $error ="sorry not registered"; mysqli_error($conn = mysqli_connect(SERVER, USER,PASSWORD, DATABASE)); } } ?> <!DOCTYPE html> <html> <head> <title>Register</title> </head> <body> <form action="" method="post"> <p style="color: red"> <?php echo $error; ?></p> Name:<input type="text" name="name" required=""><br> Email:<input type="email" name="email" required=""><br> Password:<input type="password" name="password" required=""><br> <input type="submit" name="register"> <a href="login.php"> login here...</a> </form> </body> </html>
Что я уже пробовал:
<?php include('connection.php'); $error = ""; if (isset($_POST['register'])) { $name = $_POST['name']; $email = $_POST['email']; $password = $_POST['password']; echo $name; echo $email; echo $password; $query = "INSERT INTO users(name, email, password) VALUES('$name','$email','$password')"; $results = mysqli_query($conn,$query); if ($results) { $error ="you are registered"; header('location: login.php'); } else { $error ="sorry not registered"; mysqli_error($conn = mysqli_connect(SERVER, USER,PASSWORD, DATABASE)); } } ?> <!DOCTYPE html> <html> <head> <title>Register</title> </head> <body> <form action="" method="post"> <p style="color: red"> <?php echo $error; ?></p> Name:<input type="text" name="name" required=""><br> Email:<input type="email" name="email" required=""><br> Password:<input type="password" name="password" required=""><br> <input type="submit" name="register"> <a href="login.php"> login here...</a> </form> </body> </html>
chrisnah
это не вставка данных в базу данных
Richard MacCutchan
Вам нужно точно объяснить, что происходит, когда выполняется этот код. Каков результат выполнения инструкции INSERT?