tags:

views:

53

answers:

2

When i select multiple checkbox, i get the values something like this....

9,[email protected],1,9,[email protected],2,2,[email protected],3,2,[email protected],4

Now i need to delete all of them, so i need to pass their user ID alone to query. For this i need to split the string and pass their multiple ID's alone to query.

    $var1 = $theArrayValue;
$chan= explode(',', $var1);
return $chan;

$theArrayValue holds all these info below.

9,[email protected],1,9,[email protected],2,2,[email protected],3,2,[email protected],4

I need to delete multiple items selected.

+4  A: 

name your field name="myfield[]" then it will come to php in an array

ErsatzRyan
+1  A: 

To clarify the answer above

<form action="" method="post">

<input type="checkbox" name="myfield[]" value="1" />
<input type="checkbox" name="myfield[]" value="2" />
<input type="checkbox" name="myfield[]" value="3" />

<input type="submit" />

</form>

If you vardump the $_POST variable from PHP, you will get the following output.

array(1) { ["myfield"]=>  array(2) { [0]=>  string(1) "1" [1]=>  string(1) "3" } }

In this example I selected value 1 and 3. The value of the checkbox should be the id.

Znarkus