Reputation:
I am using codeigniter form drop down.
add_store.php code is like this :-
<tr>
<td>country</td>
<td><?=form_input('country', set_value('country'));?></td>
<td class="error"><?php echo form_error('country'); ?></td>
</tr>
<tr>
<td><?=form_dropdown('Equipment',$options = array(
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
'8' => '8',
'9' => '9',
'10' => '10'));?></td>
</tr>
I added this form in to the database and it works fine.
Now I want to edit this page. I am doing something like this :-
edit_store.php page is here
<tr>
<td>country</td>
<td><?=form_input('country', set_value('country', $store['country']));?></td>
<td class="error"><?php echo form_error('country'); ?></td>
</tr>
<tr>
<td>Equipment Rating</td>
<td><?=
$selected_Equipment = $this->input->post('Equipment');
form_dropdown('Equipment'$selected_Equipment);?></td>
// what i can do here, I am doing something wrong here??????????????????????????????????????????
</tr>
My Question is: what can I do for selected Drop down coming from database ?
How to edit Drop down selected value?
So what can I do ???
Upvotes: 2
Views: 1597
Reputation: 514
Kugutsumen is right, your syntax for the form_dropdown function is a bit wrong. You can look at it here and see the arguments it takes: http://codeigniter.com/user_guide/helpers/form_helper.html
Upvotes: 0
Reputation: 600
<?php
$selected_Equipment = '1';
$options = array(
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
'8' => '8',
'9' => '9',
'10' => '10');
form_dropdown('Equipment',$options,$selected_Equipment);
?>
Hope this helps!
Upvotes: 1