a beginner here, i’m trying to direct my page to my main page after user submitted the button.Please let me know if i do anything wrong here, Thank you in advance!
localhost
// username => root
// password => empty
// database name => test
$conn = mysqli_connect(“localhost”, “root”, “”, “test”);
// Check connection
if($conn === false){
die(“ERROR: Could not connect. ”
. mysqli_connect_error());
}
if (isset($_POST[“submit”])) {
$user_name = $_REQUEST[‘user_name’];
$user_email = $_REQUEST[‘user_email’];
$user_password = $_REQUEST[‘user_password’];
$Age = $_REQUEST[‘Age’];
$sql = “INSERT INTO info VALUES (‘$user_name’,
‘$user_email’,’$user_password’,’$Age’)”;
$result = @mysqli_sql($conn,$sql);
if($result){
header(“Location:main.html”);
}
}
// Close connection
mysqli_close($conn);
?>
</center>
Hi everyone,
what i’m trying to do here is to direct the user to another page after they submit the form. I attempted to execute the code and submit the form, but it resulted in a blank page. Can you assist me?
Nur Zailani is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.