Hello:
I'm trying to obtain the text value of the select box instead of its numeric value. I have a pair of cascading select boxes which are structured in the following sql:
the html output is something like this:
After submit and based on the code above, I need to be get text Value "BRAKE SYSTEMS: rather than "2". Unfortunately, I cannot make the <option></option> value equal to the text value as my entire cascading effect is dependent on the numeric value of the first select box.
Can anyone help with a suggestion on how I can get the text value during post?
Best,
I'm trying to obtain the text value of the select box instead of its numeric value. I have a pair of cascading select boxes which are structured in the following sql:
Code:
$r = mysql_query("SELECT sc.cat_id, sc.category_label, ss.cat_id, ss.item_id, ss.subcat_label, ss.invt, ss.product_desc, ss.invt, ss.qty, ss.cost FROM service_cat AS sc INNER JOIN service_subcat AS ss ON sc.cat_id = ss.cat_id ORDER BY sc.category_label, ss.subcat_label");
if(mysql_num_rows($r)){
$dd1 = "<select name=\"categories[]\" class=\"categories\" style=\"color:#003399; text-align:justify; font-size:1.0em; border-left: none; border-right: none; border-bottom: none\"><option value=\"0\">--Select One--</option>";
$catname = '';
while($d = mysql_fetch_array($r)){
if($catname != $d['category_label'])$dd1.= "<option value=\"{$d['cat_id']}\">{$d['category_label']}</option>";
$array[$d['cat_id']][$d['item_id']] = array('subcat_label'=>$d['subcat_label'], 'invt' =>$d['invt'], 'product_desc' =>$d['product_desc'], 'qty'=>$d['qty'], 'cost'=>$d['cost']);
$catname = $d['category_label'];
}
$dd1 .= "</select>";
}
$arr = json_encode($array);
the html output is something like this:
Code:
<select name="categories[]" class="categories" ><option value="0">--Select One--</option><option value="2">BRAKE SYSTEMS</option>.....</select>
After submit and based on the code above, I need to be get text Value "BRAKE SYSTEMS: rather than "2". Unfortunately, I cannot make the <option></option> value equal to the text value as my entire cascading effect is dependent on the numeric value of the first select box.
Can anyone help with a suggestion on how I can get the text value during post?
Best,