can't delete records..
here's the codes..
<?php
mysql_connect('localhost','root','');
mysql_select_db('records');
?>
<?php
if(isset($_GET['btndelete'])){
$position = $_GET['position'];
if(isset($position)){
foreach($position as $val){
mysql_query( "DELETE FROM positions WHERE id='".$val."'" );
}
}
}
?>
<html>
<head>
<tittle>
confirm
</title>
<script>
function deleterec(){
if(confirm("Are you sure you want to delete?")){
return true;
}else{
return false;
}
}
</script>
</head>
<body>
<form name='frm' method='get' onsubmit='return deleterec()'>
<table border='1'>
<?php
mysql_connect('localhost','root');
mysql_select_db('records');
$result = mysql_query("SELECT * FROM positions")
or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
echo '<td><center><td>'<input type='checkbox' name='position' >'</tr></td>'. $row['position'] . '</td>';
}
echo "</table>";
?>
<input type='submit' name='btndelete' value='delete' />
</form>
</body>
</html>