I have a logic/code question.
I am creating a dynamic tables from a MySQL database. They contain a radiobox and a dropdown list (For quantity selection) that are dynamically named.
IE:
The order name is
Ordered.$ID
And the quantity name is
Quantity.$ID
$path = "images/";
$connpt = mysql_pconnect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($database, $connpt);
$result = mysql_query("SELECT * FROM dealer1");
echo "<table>";
echo " <tr>".
" <td width=\"100\">".'ID'."</td>"."<td width=\"100\">".'Item Name'."</td>"."<td width=\"150\">".'Item Description'."</td>"."<td width=\"150\">".'Body Copy'."</td>"."<td width=\"100\">".'Image'.
" </tr>";
while ($row = mysql_fetch_assoc($result)) {
$ID = $row['ID'];
echo " <tr>".
" <td width=\"100\">".$row['ID']."</td>"."<td width=\"100\">".$row['ItemName']."</td>"."<td width=\"150\">".$row['ItemDescription']."</td>"."<td width=\"150\">".$row['BodyCopy']."</td>"." <td width=\"100\"><img src =$path".$row['ImageName']." width=\"100\" height=\"125\"></td>"."<td width=\"150\">"."<input name=\"Order.$ID\" type=\"radio\" value=\"Ordered.$ID\">"."</td>"."<td width=\"150\">"."<select name=\"Quantity.$ID\" id=\"Quantity.$ID\"><option value=\"0\">0</option><option value=\"1\">1</option><option value=\"2\">2</option><option value=\"3\">3</option><option value=\"4\">4</option><option value=\"5\">5</option></select>"."</td>".
" </tr>";
}
echo "</table>";
My predicament is in the sendmail.php page I need to build an array of the items ordered, quantity, etc, and the name I need to get from the
$Quantity.$ID = $_REQUEST['Quantity.$ID];
is not going to work, at least I dont think so.
I hope this is making sense.
My second question is the code for the dropdown list (Quantity) could get quite long. Would a Function or OOP be a better way to handle this, although I am weak in both areas.
This by far is the toughest questions I have posted to date.
Thanks in advance for any help,
Don