Suppose I have table result in result having column Exam_Id
and Class_id
.
These two values I am taking from examid
drop-down list like below code:
<select name="examid" class="form-control" style="width:15%">
<option>Select</option>
<?php
$q = mysqli_query($con, "SELECT Exam_ID, Class_ID FROM exam");
while($row = mysqli_fetch_assoc($q))
{
?>
<option value="<?php echo $row['Class_ID'] ?>"><?php echo $row['Exam_ID']; ?></option>
<?php
}
?>
</select>
I want to insert Class_Id
and Exam_id
in different different column respectively in result table. Is it possible to achieve?
You can get value and text of dropdown differently using jquery. Try below code.
For exam id use
$('select[name=examid] option:selected').text();
For class id use
$('select[name=examid]').val();