[support] problem with form submit function
    Davide Michel 'ZioBudda' Morelli 
    michel at ziobudda.net
       
    Sun Feb 24 16:03:53 UTC 2008
    
    
  
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.
-- 
Michel 'ZioBudda' Morelli                       michel at ziobudda.net
Consulenza sistemistica in ambito OpenSource.
Sviluppo applicazioni web dinamiche (LAMP+Ajax)
Telefono: 0200619074
Telefono Cell: +39-3939890025 --  Fax: +39-0291390660
http://www.ziobudda.net                         ICQ: 58351764  
http://www.ziobuddalabs.it                      Skype: zio_budda
http://www.ajaxblog.it        			MSN: michel at ziobuddalabs.it                   
						JABBER: michel at gmail.com
    
    
More information about the support
mailing list