Friday, 6 September 2013

Mysql Empty Post Error

Mysql Empty Post Error

<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>
This one is my post form and this one ise 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");
?>
When I tried to post. They dont give eny error but they send it to mysql
as a empty . Like this.

No comments:

Post a Comment