<form action="gonder.php" method="post">
<fieldset>
<label for="ad">Ad:</label>
<input type="text" id="ad" placeholder="Tam Adınızı Giriniz" />
<label for="soyad">Soyad:</label>
<input type="text" id="soyad" placeholder="Soyadınızı Giriniz" />
<label for="email">Email:</label>
<input type="email" id="email" placeholder="Email Adresinizi Giriniz" />
<label for="mesaj">Mesaj:</label>
<textarea id="mesaj" placeholder="Mesajınız"></textarea>
<center></center>
<center><input type="submit" value="Onaya Gönder" /></center>
</fieldset>
</form>
这个是我的帖子表格,这个是 gonder.php
<?php
$con=mysqli_connect("localhost","root","","yeniziyaretci");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="INSERT INTO mesajlar (ad, soyad, email, mesaj)
VALUES ('$_POST[ad]','$_POST[soyad]','$_POST[email]','$_POST[mesaj]')";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo "";
mysqli_close($con);
header("location:index.php?cmd=1");
?>
当我试图发帖时。他们没有给出任何错误,但他们将其作为空发送到 mysql。像这样。