I’m a new learner here. I’m having trouble to direct my page to my main page after form is being submitted. I will include my code here,
<?php
$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:http://localhost/Study/Study/main.html");
}
}
mysqli_close($conn);
?>
I’m trying to direct user to another page after form submission. However, the page goes to the blank page instead of to the page that i intended to. Please assist me with this, Thank you in advance!
New contributor
Nur Zailani is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.