I have a form where I am dynamically passing an id already of an array of populated events. I need to now pass a name so the name can later be grabbed to store in the database.
This is not working passing the name through $attributes. Because when I inspect the div element where the value appears after selected, it just shows the id of the event from the elements table.
<?php
if($user_events){
//print_r($user_events);
?>
<div class="row">
<div class="col-md-12">
<h3>Add Event To Location</h3>
<div class="row">
<div class="row">
<div class="row">
<div id="myselect" class="col-md-12">
<p></p>
<div class="form-group col-xs-5 col-lg-3">
<?php
//$user_events = '';
//print_r($user_events);
$ar=array();
foreach($user_events as $events) {
$ar[$events['id']] = $events['title'];
}
//endforeach;
?>
<?php
$attributes = 'input type = “hidden” name="posted_event[]"';
//$attributes='';
echo form_dropdown('myselect', $ar, '',$attributes);
?>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
<button id="grab1" type="button" class="btn btn-default">Clear</button>
<hr/>
</div>
Basically when I inspect the element I need to see this
<input type = “hidden” name = “posted_event[]">
Updated:
$attributes = '<input type = "hidden" name="posted_event[]">';