I should be able to figure this out, but I keep going in circles. I have a form with checkboxes. When the checkboxes are selected they tagged to be deleted.
I process those selected checkboxes with a foreach:
foreach (array_keys($_POST['checkboxselect']) as $k) {
$str .= $k.',';
}
This is my lame attempt to put the list of videos together. The sql delete I’m using is:
DELETE FROM `videos` WHERE `video_name` IN ($str)
So I’m missing lots of things here. The $str needs to have:
- Only one checkbox is returned so return string with quotes (i.e. “myvideo.mp4”)
- Multiple checkboxes are selected so build a string with quotes and commas (i.e. “myvideo.mp4″,”myvideo2.mp4″,”myvideo3.mp4”)
Thanks for the help.
Try using PHP’s implode:
— Update —
Using Joomla APIs: