I haven't found any solutions for my problem so I decided to ask. I would like to redirect my php script page after submitting a form, so I use header at the end of my codes! Interestingly, when I test it in my localhost, it works and redirects the page successfully, but, when I test it in my remote server it fails to redirect the page! and when I submit the form, it goes to the from processing script and show a blank page! I wonder if anyone can help me on this matter.
and here is my codes in the form processing script:
<?php require_once('Connections/db.php'); ?>
<?php
if (isset($_POST['submit']))
{
$name = mysqli_real_escape_string($connection, $_POST['name']);
$email = mysqli_real_escape_string($connection, $_POST['email']);
$subject = mysqli_real_escape_string($connection, $_POST['subject']);
$message = mysqli_real_escape_string($connection, $_POST['message_area']);
$sql = "INSERT INTO contact_messages (name, email, subject, message)
VALUES ( '$name', '$email', '$subject','$message')";
$result = mysqli_query($connection, $sql);
if($result){
header('Location: http://www.mylink/index.htm');
exit();
}
else{
echo "ERROR: Could not execute the form " . mysqli_error($connection);
}
}
?>