I have a simple photo gallery using CodeIgniter that displays thumbnails and select buttons for each image. On this page I also have a choose file and 'upload' button and a 'delete selected items' button.
<form action="http://localhost:8080/PhpProject1/gallery"
method="post" accept-charset="utf-8" enctype="multipart/form-data">
<input type="file" name="userfile" value="">
<input type="submit" name="upload" value="Upload">
<input type="submit" name="delete" value="Delete Selected">
</form>
My check boxes are grouped using the following style (i.e. 'photos[]' for group):
<input type="checkbox" name="photos[]" value="IMG_20120709_151023.jpg">
When debugging with Netbeans I am definitely calling the right method by getting the name value from the post data but with the 'delete' method the post data contains nothing else, just the input name and value (key= delete, value = Delete Selected)using. Here is the php code:
$this->load->model('gallery_model');
if ($this->input->post('upload')) {
$this->gallery_model->do_upload($order_no);
redirect('gallery');
}
if ($this->input->post('delete')) {
$this->gallery_model->do_delete($order_no); // this is getting called ok, just no $_post data??
redirect('gallery');
}
Is there something else I need to do to ensure the post request is picking up the selected items? I'd like to do this with php but if I have to go down the ajax route so be it, thanks.
Mick.