How to store input from checkboxes into MySQL using PHP?
Feb 28th, 2009 | By KC | Category: My SQL RelatedI wish to supplement categories to the companies database. Based upon an additional educational we done 3 tables:
companies
categories
lookup_category
lookup_category someway stores the attribute in between the alternative two, though the tutorial’s e.g. formula was full of errors as well as gaps, so I’m stuck.
What’s the many efficient/flexible approach to supplement “a categories dimension” to the pick up of annals in MySQL? Can any one give the nude down operative e.g. but BS?
Thanks!
You can’t check checkboxes in Php, but you can set values in javascript that will be passed to Php:
the form:
function js_check(theForm)
{
if (theForm.elements['checkbox1'].checked)
theForm.elements['phpbox1'].value = 1;
if (theForm.elements['checkbox2'].checked)
theForm.elements['phpbox2'].value = 1;
}
Your receiving Php script reads phpbox#. If set to 1, then box is checked.