I have a problem that I just cannot get my head round at all
I output the result to a htm page all ok with a select tick box then goto the delete button and delete all selected
BUT I want to put on a SELECT ALL button that would just select all of them and delete them instead of me haveing to tick each one
I have read and read php help files but just cannot find how to do that anywhere
Woud you be so kind to show me how I can do this or point me in the right place
here is the code as I have it now
code start
<?php
require_once './inc/application.php';
if (hwDeleteZeroUsers('SELECT u.* FROM '.TBL_USER.' u LEFT JOIN '.TBL_AD.' a ON u.id=a.userid WHERE a.userid IS NULL')) echo 'User(s) removed';
function hwDeleteZeroUsers($ql){
global $O_UFS,$db;
$a_ids = array();
$user_info = array();
$res = $db->query($ql);
if($db->num_rows($res)==0) return 0;
while($v = $db->fetch_assoc($res)){
$a_ids[] = $v['id'];
$user_info[$v['id']]['username']=$v['username'];
$user_info[$v['id']]['email']=$v['email'];
DeleteRelFiles($v,$O_UFS->A_UPLOAD_DB);
}
if ( (!$_POST['delete']) OR (!count($_POST['id'])) ) {
echo '<html><head><title>Delete utility</title></head><body><form method="post">';
foreach ($a_ids AS $value) {
echo '<input type="checkbox" name="id[]" value="'.$value.'"> '.$user_info[$value]['username'].' <'.$user_info[$value]['email'].'><br>';
}
echo '<input type="submit" name="delete" value="Delete"></from></body></html>';
return 0;
}
$a_ids = implode(',',$_POST['id']); #implode(',',$a_ids);
$args = array(
'STR_IDS' => $a_ids,
);
hwModEvent('onUserDelete',$args);
//hwDeleteAds('SELECT * FROM '.TBL_AD.' WHERE userid IN('.$a_ids.')');
//$ql = preg_replace('/^.*?FROM/is','DELETE FROM',$ql);
$ql = 'DELETE FROM '.TBL_USER.' WHERE id IN('.$a_ids.')';
$db->query($ql);
return 1;
}
?>
code end
Thank you