public function new_customer() { $this->load->helper('form'); $this->data['nombre'] = array( 'name' => 'a[name]', 'id' => 'name', 'type' => 'text', ); $this->data['lastname'] = array( 'name' => 'a[lastname]', 'id' => 'lastname', 'type' => 'text', ); $this->load->file(FCPATH.'ajaxfw.php'); $ajax = ajax(); $ajax->sendButton = $ajax->form(base_url().'ajax/newcustomer/validateNewCustomer'); load_view('v_newCustomer', $this->data);
<scrip defer='defer' id='cjax_lib' type='text/javascript' src='<?php echo base_url();?>/cjax/core/js/cjax-5.5.min.js'></scrip> <?php echo form_open("");?> <p> name: <?php echo form_input($name);?> </p> <p> Last name: <?php echo form_input($lastname);?> </p> <p><?php echo form_submit('submit', 'New customer','id="sendButton"');?></p> <?php echo form_close();?>
$ajax = ajax(); $ajax->alert($form_fields['name']); //print value successfully $ajax->alert($this->input->post('a[name]')); //print undefined $ajax->alert($this->input->post($form_fields['name'])); //print undefined