I have made a table which gets data from a mysql database and puts in into a html form. However, I have been trying to make buttons on each row which would then have a variable value equal two one of the values in the rows. Here is my code:
$html_table = '<table border="1" cellspacing="0" cellpadding="2"><th>Company Symbol </th><th>Amount </th><th>Actual Stockprice </th><th>Total Value </th><th> Sell? </th><tr>';
while ($row = mysql_fetch_array($result))
{
$actstock = "\n".$json_output['l'];
$company = $row['company'];
$totalvalue = $row['amount']*$actstock;
$radio="<input type='radio' value='$company' name='symbol' />";
$dollar = "$";
$html_table .= '<tr><td>' .$row['company']. '</td><td>'
.$row['amount'].'</td><td>'
.$dollar.$actstock. '</td><td>' .$dollar.$totalvalue.'</td><td>' .$radio. '</td></tr>';
}
And then a button and then then
$symbol = $_POST['symbol'];
echo $symbol;
Any help would be great, thank you.
i think your code is good
but did you put $radio between
<form></form>on that<td>$radio</td>?