elabuwa Posted October 5, 2009 Share Posted October 5, 2009 Hey guys, I have a list box named "tax_code" which is populated dynamically when page is loaded. the code for populating is below. <select name="tax_code" id="tax_code"> <option value="NA">NA</option> <?php $tbl_name="tax_table"; // Table name $query="SELECT code FROM $tbl_name ORDER BY code"; $result=mysql_query($query); $num=mysql_num_rows($result); If ($num != 0){ while($row = mysql_fetch_array($result)){ $idz = $row['code']; echo "<option value='".$row."'>".$idz."</option>"; } } //echo "<option value='V0'>VAT 123 </option>"; ?> that works fine. the problem is when I try to get the list's selected value by $_POST['tax_code'] it returns the string "Array". the selected item name does not appear. But when I do the same method for another list the value appears as expected. I tried rewriting the code, copyin and pastin from the workin one with no luck. can you please point me in the right direction? the code for getting the value is $taxcode = $_POST['tax_code']; echo $taxcode; exit; which returns "Array" thanks a lot in advance Quote Link to comment Share on other sites More sharing options...
jon23d Posted October 5, 2009 Share Posted October 5, 2009 $row is an array, if you want a specific field, select it and use that in the option's value. Quote Link to comment Share on other sites More sharing options...
elabuwa Posted October 5, 2009 Author Share Posted October 5, 2009 thanks jon it worked. seems like my head is out of its place.lol. thanks again Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.