Welcome Guest, Not a member yet? Register   Sign In
How can we delete multiple by checkbox
#3

[eluser]NateL[/eluser]
[quote author="veasna" date="1252692082"]I don't know how to delete multiple by checkbox in codeigniter. How can i do?
for example i used to assign to url like exmple.com/index/delete/2,3,4 but i don't how can i do it?[/quote]

When you're creating your check boxes, you will create a checkbox array, like so:

Code:
<form method="POST">
<input type="checkbox" name="username[10]" value="Jon Doe" />
<input type="checkbox" name="username[11]" value="Jane Doe" />
</form>

This, being out put dynamically of course. In your database, you would have a table with an "id" field, which represents 10 and 11 in the above example.

When you click both of these buttons, and then click a "delete" button, this will post an associative array that will look like this:

Code:
array
      10 => string 'Jon Doe' (length=7)
      11 => string 'Jane Doe' (length=8)
Now you run a delete sql command inside a "foreach" loop that will remove the entry with that ID number.

This is quick and dirty...someone else may have a better suggestion, and I - for one - would definitely like to hear it, because I'm always looking for new ways to deal with checkboxes and radio buttons


Messages In This Thread
How can we delete multiple by checkbox - by El Forum - 09-11-2009, 07:01 AM
How can we delete multiple by checkbox - by El Forum - 09-11-2009, 07:19 AM
How can we delete multiple by checkbox - by El Forum - 09-11-2009, 07:46 AM
How can we delete multiple by checkbox - by El Forum - 09-11-2009, 07:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB