代码适用于localhost但不适用于实时服务器。只是张贴表格,我不知道该怎么做。 Connectin没问题。我试过,它工作正常。我还检查了标题和路径是否正常。问题可能与价值观有关。任何帮助都会很棒。感谢..
这是我的代码
<?php
$conn = mysqli_connect("localhost","servet","getwell","chance");
mysqli_set_charset($conn,"utf8");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
mysqli_set_charset($conn,"utf8");
if(isset($_POST['send'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$ip = $_SERVER["REMOTE_ADDR"];
$q ="insert into service(name,email,ip) values ('$name','$email','$ip')";
if (mysqli_query($conn,$q))
{
header('Location: product.php');
exit(header("Location: product.phpr"));
}
else {
echo "<h2 style='text-align:center; padding:1px; margin-top:-3%;'>Try later</h2>";
}
}
?>