This page isn’t working right nowIf the problem continues, contact the site owner. HTTP ERROR 405.
i have properly connected my database with php by using the code below and it prints out registration successfuly.
<?php
$u_name = $_POST['username'];
$u_password = $_POST['password'];
$servername = "localhost";
$username = "root";
$password = "***";
$dbName = "test";
//create connection
$conn = new mysqli($servername, $username, $password, $dbName);
//check connection
if($conn->connect_error){
die("Connection Failed: " . $conn->connect_error);
}
else{
$stmt = $conn->prepare("insert into login(username, password) values(?, ?)");
$stmt->bind_param("ss", $u_name,$u_password);
$stmt->execute();
echo("Registration Successfully...");
$stmt->close();
$conn->close();
}
?>
but once i add method="post", action="name of my php file", on my form in html code, and run the server, i can clearly enter the information in the login form but once i submit, i get the error message: This page isn’t working right nowIf the problem continues, contact the site owner. HTTP ERROR 405. in cmd i get: Closed without sending a request; it was probably just an unused speculative preconnection
i'm expecting that on submit button click the entered information registers in my database table and i can query it. But instead i get the error and it the entered information doesn't enters in my database table
1条答案
按热度按时间sr4lhrrt1#
Your
echo("Registration Successfully...");
does not check if it was really successful or not.Try to add this code:
I assume that you are using a local server so it should show you some errors to give you idea of what went wrong.