Hi this is code to display the list of values with an checboxes
now i want to store the values selected into database. i want the php tag how to store the array of values which have been selected pls help me out..............

    $result = mysql_query("SELECT * FROM  service_type ");
    while($row = mysql_fetch_array($result))
            {
            ?><input type="Checkbox" name="b[]"  value=""> <?echo $row['servicet'];
            echo "<br />";

            }
        }

Edited 3 Years Ago by Dani: Formatting fixed

No just it should be possible to store the selected list of values in db .........thats it

You have to create database fields with checkbox names..and update that field with 1,if the check box is checked...

This is very simple, try this.....

foreach($b as $value){
mysql_query("insert into ur_nxt_tab values($value,...)") or die(mysql_error());
}

but keep in mind the value insertion field must be the first field in your table

Hi i am getting this error..........for these statements
$servicec = implode(",",$_POST);
$servicet = implode(",",$_POST);
$services = implode(",",$_POST);
Warning: implode() [function.implode]: Invalid arguments passed in

a,b ,c are the arrays........
$servicec = implode(",",$_POST);
$servicet = implode(",",$_POST);
$services = implode(",",$_POST);

This article has been dead for over six months. Start a new discussion instead.