<?php
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("agenda") or die(mysql_error());
$q = mysql_query("INSERT INTO kontakte (emri, mbiemri,e-mail,nr,adresa,shenime) VALUES(
'{$_POST['emri']}'
'{$_POST['mbiemri']}',
'{$_POST['e-mail']}',
'{$_POST['nr']}',
'{$_POST['adresa']}',
'{$_POST['shenime']}')
");
if (!$q) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
?>
<html>
<head></head>
<body>
<div class="box">
<form action="kontakt.php" method="POST">
<p>Emri<input type="text" name="emri">
<p>Mbiemri <input type="text" name="mbiemri">
<p>E-mail<input type="text" name="e-mail">
<p>Nr tel<input type="text" name="nr">
<p>Adresa<input type="text" name="adresa">
<p>Shenime<textarea name="shenime" rows="6" cols="25"></textarea><br />
<input type="submit" value="Krijo">
<input type="reset" value="Clear">
</form>
</div>
</body>
</html>
Can anyone tell me what is wrong with the caode? i get undefined index for every input i want to make, this is the error i get on the browser:
Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-mail,nr,adresa,shenime) VALUES( '' '', '', '', '', '')' at line 1 Whole query: