Checkbox values in array session as string

1

I want to put a array in the values of a checkbox but as string and so that they are separated by% use in a mysql query array('string1','string2') .

These values come from a checkbox for a session:

$variavel= $_SESSION['checkbox'] = implode(',',$_POST['checkbox']);

In this way, it separates only the values with IN('string1','string2') , , , but when together a value string it gives error.

How can I merge each value into the array to be array(int1,int2) ?

    
asked by anonymous 23.06.2015 / 19:38

1 answer

1

Well, I found a solution that might not even be the right one, but it worked right through the value of the checkbox, where I just concatenated the hiffen before and after the result.

If there is a more pro solution to this situation, I appreciate the help and / or clarification.

My checkbox:

<input name="chekcbox[]" type="checkbox" id="chekcbox" value="<?php echo "'".$linhaQueryMySql['campo']."'"; ?>" <?php if(strpos($variavel1,$linhaQueryMySql['campo'])!== false) echo 'checked="checked"'?> />
    
23.06.2015 / 19:45