0

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

Edited by Dani: Formatting fixed

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by Shanti C
0

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'];">
0

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...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.