How to post multiple rows?

<input type=”text” name=”nama[]”>
<input type=”text” name=”umur[]”>

in this case i use codeigniter framework

this is my controller

function post(){
$nama = $this->input->post(‘nama’);
$umur = $this->input->opst(‘umur’);

for($i = 0; $i < count($nama); $i++){
$for_insert = array(
array(
‘nama’ => $nama[$i],
‘umur’ => $umur[$i]
),
);
$this->save->all($for_insert);
}
}
this is my model

function all($for_insert)
{
$this->insert_batch($for_insert);
}

i hope this help who need this.

Advertisements

How to Check .htaccess Work or Not In Virtualhost

how to ?

create file .htaccess in root folder virtualhost

add this line in .htaccess

RewriteEngine On
Options +FollowSymLinks
RewriteRule ^test\.html http://www.google.com/? [R=301,L]

and save.

now open your browser

open url like this http://virtualhost/test.html

if you hit the link, and redirect to google. your .htacccess is working.

enjoy.

link ref: http://www.qualitytuts.com/check-htaccess-is-working-or-not-on-server/