sql - how to post html field arrays in forms using php -


i have form having 2 fields .

 <td class="left"><input style="  width: 30%; text-align: center;" type="text" name="name[]" value="<?php echo $geo_zone['name']; ?>" /></td>  <td class="left"><input style="  width: 30%; text-align: center;" type="email" name="email[]" value="<?php echo $geo_zone['email']; ?>" /></td> 

if print_r arrays perfect result. this

$name = $this->request->post['name'];; $email = $this->request->post['email'];;  

but want keep inserting these 2 values in database until arrays empty ($name , $email).for tried each loop inserts 1 row in database.

 foreach( $name $key => $n ) {      $this->data['geo_zone_id']=$this->model_module_shipping_pools->get_geo_zone_id($n);       $geo_zone_id=$this->data['geo_zone_id'];     $geo_zone_id=$geo_zone_id[0]['geo_zone_id'];      $this->model_module_shipping_pools->drop_data();     $email=$email[$key];      $this->model_module_shipping_pools->insertdata($geo_zone_id,$email);      } 

$email=$email[$key]; - you're overwriting $email variable. call else.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -