duanjiangzhi6851 2018-11-27 17:26
浏览 20

将网站和数据库上传到服务器后,我的php文档没有重定向到我的链接

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.example.com/'><i class='fas fa-home'></i>Volver a Inicio</a>";
} else {
  echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
 ?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 划分vlan后不通了
    • ¥15 GDI处理通道视频时总是带有白色锯齿
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 Revit2020下载问题
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大