+4 votes
244 views
in Programming by
Hi all , I am trying to get all drop down values on bases of id but the problem is I am getting a single value as output but I want each value in an array using PHPQuery.

HTML Code :

<select name="product" id="product" class="dropdown" onChange="javascript:selectProduct(this, this.form);">

 <option value="">-- Select Products --</option>

 <option value="mobiles" selected>mobiles</option>

 <option value="tablets" >tablets</option>

 <option value="laptops" >laptops</option>

<option value="smartwatch" >smartwatch</option>

</select>

I am trying like this :

$products = $all['#products'];

foreach ($products as $products) {

echo pq($products)->text();

 echo '<br>';

}

 

please help asap.
by
$_post['your select tag name']

1 Answer

0 votes
by
not possible in this way.

 

you have to make string of all options then make a hidden textbox,

assign values string to that   textbox ,

then get textbox in php.

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated