Jump to content

Multiple checkbox select actions


ecopetition

Recommended Posts

Hi there, I'm trying to make a private messaging system and wondered if you could advise me how to select multiple messages at once and perform actions on the selected messages. Here's the HTML code for the "inbox" page:

 

<form action="messages.php?m=delete_pm" method="post">
<table border="0" cellspacing="1" cellpadding="2">
<tr>
<td>Subject</td>
<td>From</td>
<td>Time Received</td>
<td>Actions</td>
</tr>
<tr>
<td><a href="ucp.php?m=read_private_message&id=10">message test 2</a></td>
<td><span class="capitalise"><a href="profile.php?u=4">Poster</a></span></td>
<td>12 Aug 2009 22:11</td>
<td><input type="checkbox" name="pm[]" value="10" /></td>
</tr>
<tr>
<td><a href="ucp.php?m=read_private_message&id=8">message test</a></td>
<td><span class="capitalise"><a href="profile.php?u=4">Poster</a></span></td>
<td>12 Aug 2009 22:11</td>
<td><input type="checkbox" name="pm[]" value="8" /></td>
</tr>
<tr>
<td><a href="ucp.php?m=read_private_message&id=6">hello</a></td>
<td><span class="capitalise"><a href="profile.php?u=4">Poster</a></span></td>
<td>12 Aug 2009 20:59</td>
<td><input type="checkbox" name="pm[]" value="6" /></td>
</tr>
</table>

With Selected Messages:
<select name="mode">
<option value="delete">Delete</option>
<option value="move_2">Move to folder '2'</option>
</select>
<input type="submit" name="submit" value="Submit" />
</form>

 

The final column of each row contains a checkbox with a value/id unique to the message in question.

 

This is where I get lost, I don't know how to utilise the data sent to the form (seeing which checkboxes are selected and the "with selected messages" mode). Can anyone please help me by pointing me in the right direction?

 

Thanks a lot,

Ecopetition

Link to comment
https://forums.phpfreaks.com/topic/169990-multiple-checkbox-select-actions/
Share on other sites

<input type="checkbox" name="pm[]" value="6" />

 

<input type="checkbox" name="pm[]" multiple="multiple" value="6" />

 

Multiple allows for more than one checkbox to be selected at a time.

 

I think that's for multiple select menus :)

 

Works on checkboxes.  I use it all the time.  Never an issue.  ^_^

<input type="checkbox" name="pm[]" value="6" />

 

<input type="checkbox" name="pm[]" multiple="multiple" value="6" />

 

Multiple allows for more than one checkbox to be selected at a time.

 

I think that's for multiple select menus :)

 

Works on checkboxes.  I use it all the time.  Never an issue.  ^_^

 

Um... pretty sure it isn't doing anything being there as checkboxes allow multiple selections inherently... Create 5 checkboxes on a page and select multiple boxes, I'm sure it won't be a problem even without the extra attribute as I have been building html forms for 10 years and have never used it once ;)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.