HTML Code:
<form action="new_isy.php" method="POST">
First name:<br>
<input type="text" name="fname"><br>
Last name:<br>
<input type="text" name="lname"><br>
Email:<br>
<input type="text" name="email"><br>
Head<br>
<input type="text" name="head"><br>
Message<br>
<textarea name="message" cols="30" rows="8"></textarea><br>
<select name="category">
<option>option1</option>
<option>option2</option>
<option>option3</option>
<option>option4</option>
</select><br><br>
<input type="submit" value="Send"></form>
new_isy.php:
PHP Code:
$date = date("Y-m-d H:i:s");
$sql = "INSERT INTO `ads`
(
`fname`,
`lname`,
`email`,
`head`,
`message`,
`category`,
`date`
)
VALUES (
'{$_POST['fname']}',
'{$_POST['lname']}',
'{$_POST['email']}',
'{$_POST['head']}',
'{$_POST['message']}',
'{$_POST['category']}',
'$date'
)";
mysql_query($sql) or die("SQL: $sql ".mysql_error());
// ##### Back to main page #####
header ("Location: index.php");
exit;
Ok so i want option1/option2/option3/option4 to be saved in the field called "category". The point is that people can choose a category and that category should be saves in the db. What am i doing wrong?
Thanks in advance
Niklas