Reputation:
I am Doing a edit form option for admin so that he can update things..
for normal input box i am using
<input name="eve_title" class="form-control" type="text" value="<?php echo set_value('eve_title',$event_name); ?>">
were $event_name contains editted data for particular id..
but when i use smae thing with dropdown i am not getting editted value in it.
<select class="form-control" name="eve_type" id="eve_type" value="<?php echo set_select('eve_type',$); ?>">
<option value=''>--Select Event Type--</option>
<option value="<?php echo set_select('eve_type', 'Exhibition'); ?>">Exhibition</option>
<option value="<?php echo set_select('eve_type','College/ School Fest');?>" > College/ School Fest </option>
<option value="<?php echo set_select('eve_type', 'Conference');?>" > Conference </option>
<option value="<?php echo set_select('eve_type', 'Concert/ Entertainment');?>" > Concert/ Entertainment </option>
<option value="<?php echo set_select('eve_type', 'Corporate Internal Event');?>" > Corporate Internal Event </option>
</select>
How to achieve this?
Upvotes: 1
Views: 43
Reputation: 1273
You need to use set_select, not a set_value for your dropdown. Please take a look at official doc: https://www.codeigniter.com/userguide3/helpers/form_helper.html?highlight=set_select#set_select
Example:
<select name="myselect">
<option value="one" <?php echo set_select('myselect', 'one', TRUE); ?> >One</option>
<option value="two" <?php echo set_select('myselect', 'two'); ?> >Two</option>
<option value="three" <?php echo set_select('myselect', 'three'); ?> >Three</option>
</select>
Upvotes: 1