Welcome Guest, Not a member yet? Register   Sign In
How to proceed an array post input
#1

[eluser]Edy S[/eluser]
Hi everybody, i just new in codeIgniter, can every body help me proceed my array post input ?
Here the part of my code
Code:
//create table for action
echo      form_input().
         '<table id="resep" class="tbmodule">'.
     '<tr>'.
     '<td class="title">No</td>'.
     '<td class="title">Jenis Obat'.
     '</td>'.
     '<td class="title">Jumlah</td>'.
     '<td class="title">Dosis</td>'.
     '</tr>'.
    
     '<tr><td>1</td><td>'.form_input('obat[1]','','size="30"').'</td> <td>'.form_input('jumlah[1]','','size="10"').'</td> <td>'.form_input('dosis[1]','','size="10"').'</td></tr>'.
     '<tr><td>2</td><td>'.form_input('obat[2]','','size="30"').'</td> <td>'.form_input('jumlah[2]','','size="10"').'</td> <td>'.form_input('dosis[2]','','size="10"').'</td></tr>'.
     '<tr><td>3</td><td>'.form_input('obat[3]','','size="30"').'</td> <td>'.form_input('jumlah[3]','','size="10"').'</td> <td>'.form_input('dosis[3]','','size="10"').'</td></tr>'.
     '<tr><td>4</td><td>'.form_input('obat[4]','','size="30"').'</td> <td>'.form_input('jumlah[4]','','size="10"').'</td> <td>'.form_input('dosis[4]','','size="10"').'</td></tr>'.
     '<tr><td>5</td><td>'.form_input('obat[5]','','size="30"').'</td> <td>'.form_input('jumlah[5]','','size="10"').'</td> <td>'.form_input('dosis[5]','','size="10"').'</td></tr>'.
     ''.
     '</table>'.
         form_close();

in my controller, i want to use data parse that contain like this ( just part ) :

Code:
foreach($this->input->post('obat') as $key => $val){
    $resep .=$val.'||'.$this->input->post('jumlah['.$key.']').'||'.$this->input->post('dosis['.$key.']').'{}';
}

My problem now, i cant access to input->post('jumlah') and input->post('dosis') and when i echo $resep , It just display the value of input->post('obat'). I have try to directly write input->post('jumlah[1]') and it cant still display the value when i submit it.


Please help me ...
#2

[eluser]Irfan Cikoglu[/eluser]
Code:
foreach ($this->input->post( 'obat' ) as $key => $val) {
    $objects  = $this->input->post( 'jumlah' );
    $objectdo = $this->input->post( 'dosis' );
    $resep .= $val . '||' . $objects[$key] . '||' . $objectdo[$key] . '{}';
}

I tried this and it works Wink
#3

[eluser]Edy S[/eluser]
[quote author="Irfan Cikoglu" date="1310159029"]
Code:
foreach ($this->input->post( 'obat' ) as $key => $val) {
    $objects  = $this->input->post( 'jumlah' );
    $objectdo = $this->input->post( 'dosis' );
    $resep .= $val . '||' . $objects[$key] . '||' . $objectdo[$key] . '{}';
}

I tried this and it works Wink
[/quote]

yes, you're absolutely right irfan
It's work well now ...
Thanks a lot for your help ..
;-)
I can now continue my code
#4

[eluser]Irfan Cikoglu[/eluser]
[quote author="Edy S" date="1310160332"][quote author="Irfan Cikoglu" date="1310159029"]
Code:
foreach ($this->input->post( 'obat' ) as $key => $val) {
    $objects  = $this->input->post( 'jumlah' );
    $objectdo = $this->input->post( 'dosis' );
    $resep .= $val . '||' . $objects[$key] . '||' . $objectdo[$key] . '{}';
}

I tried this and it works Wink
[/quote]

yes, you're absolutely right irfan
It's work well now ...
Thanks a lot for your help ..
;-)
I can now continue my code[/quote]
Good Works, mate Smile




Theme © iAndrew 2016 - Forum software by © MyBB