Forum Moderators: coopster
if(isset($_POST[categories]) {
if (!is_bool(strripos(implode(",", $_POST[categories]),"Checkbox Value")))
$checked="checked";
else $checked="";
}
and then int he input, I call the variable $checked, which is either 'checked' or blank. I get the followin g errormsg: Warning: implode() [function.implode]: Bad arguments. (referring to each line)
I've tried a variety of different things here - I also tried doing if(isset($_POST['categories[0]']))$checked="checked";else $checked=""; to no avail. I've searched and searched and cant seem to find anyone with a similar situation....
Does anyone have any recommendations for the best way for the checkboxes that were checked to be re-checked when the form loads again? Or can find something wrong with my use of implode, and why its not working here? Thanks - I know this problem is a little convoluted...
-will
$checkboxarray=explode(",",$_POST[$checkboxname]);
// this gets the POSTed stuff and puts
// it back into a handy array
// if you're going to loop, start it here
$checkboxvalue='cheese';
// write the beginning of the tag.
print("<input type='checkbox' name='".$checkboxname."[]' value='".$checkboxvalue."'");
// does it get the "checked" attribute?
if (in_array($checkboxvalue,$checkboxarray)){
print(" CHECKED"); // note the space before the word
}
print(">"); // end the tag
print($checkboxvalue."<BR>"); // print the caption
// if you're going to loop, end it here