I need to get all the values of a dropdown in an array based upon the id
of the dropdown using PHPQuery.
The following is the HTML:
<select name="semester" id="semester" class="inputtxt" onChange="javascript:selectSemester(this, this.form);">
<option value="">-- Select your Semester --</option>
<option value="2nd" selected>2nd</option>
<option value="4th" >4th</option>
<option value="6th" >6th</option>
<option value="8th" >8th</option>
<option value="SE1" >SE1</option>
<option value="SE3" >SE3</option>
<option value="SE5" >SE5</option>
<option value="SE7" >SE7</option>
</select>
I tried this:
$semesters = $all['#semester'];
foreach ($semesters as $semester) {
echo pq($semester)->text();
echo '<br>';
}
But I get only a single output with all the values concatenated. How do I get each value as separate element in an array?