How to pass options value from each table row?

nurecoope

New Member
I am creating a table with rows which has options in each cells. The options are received from database table. Since each row has a options cell, I have to receive the value from each row. In select tag, the 'name' is incremented with the rows. But I am only getting the value of the last row.Attaching the code section here.\[code\]for ($i = 1; $i <= $_GET['pno']; $i++) { echo'<tr>'; echo "<td>$i</td>"; echo '<td><select name="prod_$i">'; echo "prod_$i"; //Query for production table gets processed. $qry_pr="SELECT * FROM production"; $result_pr=mysql_query($qry_pr); $rows_pr=mysql_affected_rows($con); //Production options get filled from the table data. for($j=0;$j<=$rows_pr;$j++) { $res_arr_pr=mysql_fetch_array($result_pr); echo "<option value=http://stackoverflow.com/questions/10554166/$res_arr_pr[0]>$res_arr_pr[1]</option>"; //$res++; } //mysql_close($con); echo '</select></td>'; echo '<td><select name="prod_mu_$i">'; //Query for measurement_unit table gets processed. $qry_mu="SELECT * FROM measurement_unit"; $result_mu=mysql_query($qry_mu); $rows_mu=mysql_affected_rows($con); //Unit options get filled from the table data for($k=0;$k<=$rows_mu;$k++) { $res_arr_mu=mysql_fetch_array($result_mu); echo "<option value=http://stackoverflow.com/questions/10554166/$res_arr_mu[0]>$res_arr_mu[1]</option>"; } echo '</td>'; echo '</tr>'; echo "prod_$i"; } echo'</table><br>';\[/code\]Hope I am clear with the query.Thank you.
 
Back
Top