Hi all. I have this function:
function add_lU_form_submit($form,$form_values) { $ecomm2= (isset($form_values['ecomm'][1])) ? TRUE : FALSE; $visibile = (isset($form_values['visibile'][1])) ? TRUE : FALSE; $query = 'insert into mw_lU(name,peso,ecomm,visibile) values("'.$form_values['name'].'",'.$form_values['peso'].','.$ecomm2.','.$visibile.')'; echo $query; //For test [...] }
with this form:
$form['name'] = array( '#title' => 'Nome del livello', '#type' => 'textfield' );
$form['peso'] = array( '#title' => 'Peso', '#type' => 'select', '#options' => array(0=>0,1=>1, 2=>2,3=>3) );
$form['ecomm'] = array( '#title' => 'Ecomm', '#type' => 'checkboxes', '#description' => t('Da passare all'ecommerce'), '#options' => array("si"), '#default_value' => TRUE );
$form['visibile'] = array( '#title' => 'Visibile', '#type' => 'checkboxes', '#description' => t("Visibile negli altri form"), '#options' => array("si"), '#default_value' => TRUE
Now when I click on the form's submit button (I don't check the ecomm checkboxes field), Drupal call "add_lU_form_submit()", and this is ok, but $query is "insert into mw_lU(name,peso,ecomm,visibile) values("per tutti",2,,1)". Note the absence of the FALSE value (0) for the ecomm field.
Where is my error ???
TNX.