I hope you are having a fantastic day. I finished my website and decided to upload it to the hosting server and make it public. After loading the website to the hosting server my php documents are sending data to the database fine, but it doesn't redirect to the link that I redirected it, and it stays in the php document. I don't know why is this happening. Before uploading the website to the hosting server, in the local server it was redirecting to the link.
Here I attach my code:
<?php
$servername = "servername";
$username = "name";
$password = "password";
$dbname = "database";
//Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
//Check connection
if ($conn->connect_error) {
die ("Connection Failed: " . $conn->connect_error);
}
$sql ="INSERT INTO clientesdudas (user_id, nombreapellido, email, mensaje)
VALUES (NULL, '$_POST[nombre]', '$_POST[correoElectronico]', '$_POST[mensaje]')";
if ($conn->query($sql) === TRUE) {
header("Location: http://www.website.com/");
//echo "Tu mensaje se ha mandado correctamente, nos pondremos en contacto contigo lo más temprano posible. Gracias! <br> <a href='http://www.fisiodoctoresvalencia.com/'><i class='fas fa-home'></i>Volver a Inicio</a>";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
Thank you very much.
Aucun commentaire:
Enregistrer un commentaire