php - using array input names in forms and form validation - CodeIgniter -
i have form on submit send data 2 different tables.so thought writing me deal posted data easily.
<?=form_input(array('name'=>'item["item_manufacturer"]','class'=>'form-control'),set_value('item["item_manufacturer"]'));?> <?=form_input(array('name'=>'vat["vat_percentage"]','class'=>'form-control'),set_value('vat["vat_percentage"]'));?>
and in config/form_validation
config file,i have this
$config = array( 'products/add' =>array( array('field'=>'item["item_manufacturer"]','label'=>'lang:manufacturer-name','rules'=>'required|trim|xss_clean'), array('field'=>'vat["vat_percentage"]','label'=>'lang:vat-percentage','rules'=>'required|trim|xss_clean') ));
but comes form_validation
result false if entered inputs.
all want write this,
$this->db->insert('items',$this->input->post('item')); $this->db->insert('vats',$this->input->post('vat'));
isn't possible this? or there better way? hope helps
solved
small mistake, changed 'item["item_manufacturer"]'
"item[item_manufacturer]"
:)
solved
small mistake, changed 'item["item_manufacturer"]'
"item[item_manufacturer]"
:)
Comments
Post a Comment