I'm trying to save a dynamic values (from api) to my localdb for offline processing. I have 2 fields, event_id and event_name in dropdown directly coming from the API.
<select name="event_id" class="form-control" id="change">
<label>Select Live Event </label>
<?php foreach($events as $event): ?>
<option value="<?=$event->eventid;?>">
<?=$event->name;?>
</option>
<?php endforeach; ?>
</select>
Now I want user to select an event and save both event id and event name in local database. I know how to handle event_id but problem is event_name.. How do I assign a variable to this so that I could save both event_id and event_name at the same time.