I've 2 combo boxes in my front end html form, user has to select values from both the combo boxes to delete records frm mysql table, my delete query is not being executed,, please help me out..
herez my front end form,
Code: Select all
<TD CLASS="text">
<SPAN STYLE="font-weight: bold; color:#001F97;">
Batch ID:
</SPAN>
</TD>
<td>
<select name="Batch" style="width:180px; font-weight:bold; color:#001F97;"><option value="" selected="selected"><b>-Select Batch ID-</option></b>
<option value="T08" style="font-weight:bold">T08</option>
<option value="T09" style="font-weight:bold">T09</option>
<option value="T10" style="font-weight:bold">T10</option>
<option value="T11" style="font-weight:bold">T11</option>
<option value="T12" style="font-weight:bold">T12</option>
<option value="T13" style="font-weight:bold">T13</option>
<option value="T14" style="font-weight:bold">T14</option>
<option value="T15" style="font-weight:bold">T15</option>
</select>
</td>
</tr>
<tr>
<TD CLASS="text">
<SPAN STYLE="font-weight: bold; color:#001F97;">
Exam Type:
</SPAN>
</TD>
<td>
<select name="Type" style="width:180px; font-weight:bold; color:#001F97;"><option value="" selected="selected">-Select Type-</option>
<option value="In I" style="font-weight:bold">In I</option>
<option value="In II" style="font-weight:bold">In II</option>
<option value="In III" style="font-weight:bold">In III</option>
<option value="In IV" style="font-weight:bold">In IV</option>
<option value="Inl V" style="font-weight:bold">Inl V</option>
<option value="In VI" style="font-weight:bold">In VI</option>
<option value="Final " style="font-weight:bold">Final </option>
<option value="Ext" style="font-weight:bold">Ext</option>
</select>
</tr>
</td>
</table>Code: Select all
<?PHP
include "authn.php";
//Connect to mysql server
$link=mysql_connect("localhost","root","");
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db=mysql_select_db("tge");
if(!$db) {
die("Unable to select database");
}
$Batch = $_POST['Batch'];
$Type = $_POST['Type'];
$query = mysql_query("DELETE FROM in WHERE Type = '$Type' AND Batch = '$Batch'") or die(mysql_error());
echo "records deleted";
?>many thanks.