I am having a hard time on creating a multiple checkbox ajax delete. I am an ajax noob.
$sql = 'SELECT * FROM users';
$qry = mysql_query($sql);
$html = '';
$html .='<center>';
$html .= '<a href="" id="a-add">+ Add New User</a>';
$html .= ' || <a href="" id="a-delete"> Delete User</a>';
$html .= '<div id="div-data">';
$html .= '<table border="1" width="300px">';
$html .= '<tr>';
$html .= '<th width="5px"><input type="checkbox" id="cb-checkall"></th>'; //all
$html .= '<th> Users</th>';
//$html .= '<th>Delete</th>';
while($row = mysql_fetch_array($qry)) {
$html .= '<tr align="center">';
$html .= '<td><input type="checkbox" name="checkall" class="checkall" value="'.$row['uid'].'"/></td>';
$html .= '<td>'.$row['fname'].'</td>';
$html .= '</tr>';
}
$html .= '</table>';
$html .= '</div>';
echo $html;
delete.php (with the use of implode)
$deleteid = implode(",",$_POST['checkall']);
$fname = mysql_escape_string($_POST['firstname']);
$sql = "DELETE from `bpo`.`users` (`uid` ,`fname`)
WHERE UID IN (".$deleteid.")";
My data doesnt go to delete.php. idk why. I need help on deleting the checked rows when I push delete button and automatically reflects to my database. The change have to appear on screen without refreshing (AJAX) and with the use of implode. Thank you.