我似乎无法从我的代码中找到错误?相当混淆为什么这不起作用,任何帮助都会是惊人的! :)第31行是最后一个回声的闭括号的行。
<?php
$con = mysqli_connect('127.0.0.1','root','');
if (!$con)
{
echo 'No connection to the local server';
}
if (mysqli_select_db($con, "info"))
{
echo 'No connection to database';
}
$Name = (isset($_POST ['Full_Name']));
$MobileNumber = (isset($_POST ['Mobile_Number']));
$Email = (isset($_POST ['email']));
$Address = (isset($_POST ['address']));
$PostCode = (isset($_POST ['Post_Code']));
$Interests = (isset($_POST ['interests']));
$sql = "INSERT INTO info (Name, Mobile Number,Email,Address,Post Code,Interests) VALUES ('$Name', '$MobileNumber','$Email','$Address','$PostCode','$Interests')";
if (mysqli_query($con,$sql))
{
echo 'Details not inserted correctly';
}
else
{
echo 'Thank you for your details, we will be in touch, you will be redirected in 5 seconds';
}
header("refresh:5; url=contact.html");
?>
以下是我的表单代码
form action ="datanew.php" method = "post">
Name: <input type = "text" name = "Full Name">
MobileNumber: <input type = "interger" name = "Mobile Number">
Email: <input type = "text" name = "Email">
Address: <input type = "text" name = "Address">
PostCode: <input type = "text" name = "Post Code">
Interests: <input type = "text" name = "Interests">
<input type = "submit" value = "Enter">
</form>