Jump to content

Multiple Checkbox help


lilywong

Recommended Posts

I have a set of checkbox as below

* Soft Drink
* Cold Drink
* Mineral Water
* None

<code>
<input type="checkbox" name="chkFolder1" value="001">Soft Drink
<input type="checkbox" name="chkFolder2" value="002">Cold Drink
<input type="checkbox" name="chkFolder3" value="003">Mineral Water
<input type="checkbox" name="chkFolder4" value="004">None
</code>

User allow to select multiple choice from the set of checkbox, for eg, user select soft drink and mineral water, these 2 items will be saved into a database, as (001,003) in a same field called choice.

when i retrive from database, how should i separate the data from choice so that soft drink and mineral water is checked when i retrive the data?

thanks
Link to comment
https://forums.phpfreaks.com/topic/15661-multiple-checkbox-help/
Share on other sites

More information is really needed to answer this question.  To make checkboxes checked, just add 'checked' at the end of the checkbox tags, e.g.

<input type="checkbox" name="chkFolder1" value="001" checked>Soft Drink
<input type="checkbox" name="chkFolder2" value="002">Cold Drink
<input type="checkbox" name="chkFolder3" value="003" checked>Mineral Water
<input type="checkbox" name="chkFolder4" value="004">None


This can be achieved in a variety of ways from the database. 
Link to comment
https://forums.phpfreaks.com/topic/15661-multiple-checkbox-help/#findComment-64747
Share on other sites

  • 2 years later...
[quote author=lilywong link=topic=101887.msg403657#msg403657 date=1153895884]
I have a set of checkbox as below

* Soft Drink
* Cold Drink
* Mineral Water
* None

<code>
<input type="checkbox" name="chkFolder1" value="001">Soft Drink
<input type="checkbox" name="chkFolder2" value="002">Cold Drink
<input type="checkbox" name="chkFolder3" value="003">Mineral Water
<input type="checkbox" name="chkFolder4" value="004">None
</code>

User allow to select multiple choice from the set of checkbox, for eg, user select soft drink and mineral water, these 2 items will be saved into a database, as (001,003) in a same field called choice.

when i retrive from database, how should i separate the data from choice so that soft drink and mineral water is checked when i retrive the data?

thanks
[/quote]
I just wanna say thank you for posting this checkbox.. Hoping that this will not be the last post that I could be read written by you.



_________________
[url=http://www.ep-filters.com/]Cuno Filters[/url]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.