Hi all,
When i try to execute the insert statement...
if ($insert_faq_cat) {
$sql_query ="INSERT INTO faq_cat (title, status) VALUES ('$title', '$status')";
$result = mysql_query($sql_query);
?>
<META HTTP-EQUIV="refresh" CONTENT="1; URL=faq_admin.php">
<?
}
?>
it appears to insert the enrty that is already in the database, not the new one entered into the form.
Any ideas to why this is so?
Cheers,
micmac
Here is the complete code:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td>Please select a category in which your question/answer resides<br>
<form name="form1" method="post" action="faq_admin.php">
<select name="select">
<?
include ("include/dbconnect.php");
$result = mysql_query("SELECT * FROM faq_cat WHERE status='yes' ORDER BY title",$db);
$resultsnumber = mysql_numrows($result);
while ($row = mysql_fetch_array($result)) {
$id = $row["faq_cat_id"];
$title = $row["title"];
?>
<?
echo "<option value=\"$id\">$title</option>";
}
?>
</select>
Is the category your looking for not listed? <input type="submit" name="add_faq_cat" value="Click Here">
</form> </td>
</tr>
<?
if ($add_faq_cat){
?>
<tr>
<td> <form method="post" action="faq_admin.php">
Title:<br>
<input type="text" name="title"><br><br>
<input type="hidden" name="status" value="yes">
<input type="submit" name="insert_faq_cat" value="Add">
</form> </td>
</tr>
<?
}
if ($insert_faq_cat) {
$sql_query ="INSERT INTO faq_cat (title, status) VALUES ('$title', '$status')";
$result = mysql_query($sql_query);
?>
<META HTTP-EQUIV="refresh" CONTENT="1; URL=faq_admin.php">
<?
}
?>
</table>
</body>
</html>