Hi...
i have some values with an checkbox ......

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

            }
        }

after the execution of this code....the list of values will be displayed, e.g red,black,white,yellow etc......if he selects only two......
actually i want it to store in database ....which ever he selects whether one or two......since i have given same name for all checkboxes i am getting confused like how to store .....which particular value he has selected.......help me out.......

Thanks

Recommended Answers

All 2 Replies

The line you have write is wrong:

<input type="Checkbox" name="contype" value="B"> <?echo $row['servicet'];
//change this line to this:
<input type="Checkbox" name="contype" value="<?echo $row['servicet'];">

And you have add one more fields like service in your user table,then you will store the check boxes enabled with commas...
And we can retrieve them by using explode function...

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.