Variant Title:<input type="text" name="variant_title"><br>
Variant Option: <input type="text" name="variant_option[]"><br>
Variant Option: <input type="text" name="variant_option[]"><br>
Variant Option: <input type="text" name="variant_option[]"><br>
if (is_array($this->input->post('variant_option')):
foreach ($this->input->post('variant_option') as $value):
$variant_options[] = $value; // loop through...
endforeach;
endif;
public function add_banner_image($banner_id = 0) {
foreach ($this->input->post('link') as $link) {
$data = array(
'banner_id' => $banner_id,
'link' => $link,
);
foreach($_FILES as $field => $file) {
if (!empty($file)) {
if ($this->upload->do_upload($field)) {
$file_data = $this->upload->data();
$data['image'] = $file_data['file_name'];
}
}
}
$this->db->insert_id();
$this->db->insert('banner_image', $data);
}
}
https://www.daniweb.com/programming/web-development/threads/490296/inserting-multiple-data-php-codeigniter
Variant Option: <input type="text" name="variant_option[]"><br>
Variant Option: <input type="text" name="variant_option[]"><br>
Variant Option: <input type="text" name="variant_option[]"><br>
if (is_array($this->input->post('variant_option')):
foreach ($this->input->post('variant_option') as $value):
$variant_options[] = $value; // loop through...
endforeach;
endif;
public function add_banner_image($banner_id = 0) {
foreach ($this->input->post('link') as $link) {
$data = array(
'banner_id' => $banner_id,
'link' => $link,
);
foreach($_FILES as $field => $file) {
if (!empty($file)) {
if ($this->upload->do_upload($field)) {
$file_data = $this->upload->data();
$data['image'] = $file_data['file_name'];
}
}
}
$this->db->insert_id();
$this->db->insert('banner_image', $data);
}
}
https://www.daniweb.com/programming/web-development/threads/490296/inserting-multiple-data-php-codeigniter
Comments
Post a Comment