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 />";

            }
        }

Recommended Answers

All 9 Replies

do u want to store check box values in database which are selected with comma separated?

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

Implode work for arrays, not strings.

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

Then it has to work. Check if $_POST is null.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.