Jump to content

Archived

This topic is now archived and is closed to further replies.

cturner

Will not display combo boxes???

Recommended Posts

The code below will not display the combo boxes. Can someone please tell me why and how I can fix it? Thanks in advance.

[code]
require "config.php";
$pd_id = mysql_real_escape_string($_GET['pd_id']);
$query = "SELECT * FROM `tbl_product` WHERE `pd_id` = '$pd_id'";
$r = mysql_query($query) or die('Query error: ' . mysql_error());
$row= mysql_fetch_assoc($r);
echo "<br /><br />Please choose from the options: <br />";
echo "<br /><b>Pack size</b>: ";
print "<select name=\"selectpacksize\" id=\"selectpacksize\">";
print "<option value=\"none\" selected>Please select</option>";
while($row = mysql_fetch_array($sql)){
print "<option value=".$row['packsize1'].">".$row['packsize1']." labels</option>";
if (!empty($row['packsize2'])) {
print "<option value=".$row['packsize2'].">".$row['packsize2']." labels</option>";
}
if (!empty($row['packsize3'])) {
print "<option value=".$row['packsize3'].">".$row['packsize3']." labels</option>";
}
}
print "</select>";

if (!empty($row['colour1'])) {
echo "<br /><b>Colour</b>: ";
print "<select name=\"selectcolour\" id=\"selectcolour\">";
print "<option value=\"none\" selected>Please select</option>";
while($row = mysql_fetch_array($sql)){
print "<option value=".$row['colour1'].">".$row['colour1']."</option>";
if ((!empty($row['colour2']))) {
print "<option value=".$row['colour2'].">".$row['colour2']."</option>";
}
if ((!empty($row['colour3']))) {
print "<option value=".$row['colour3'].">".$row['colour3']."</option>";
}
if ((!empty($row['colour4']))) {
print "<option value=".$row['colour4'].">".$row['colour4']."</option>";
}
if ((!empty($row['colour5']))) {
print "<option value=".$row['colour5'].">".$row['colour5']."</option>";
}
}
print "</select>";
}

if (!empty($row['icon1'])) {
echo "<br /><b>Icon</b>: ";
//$sql = mysql_query("SELECT * FROM `tbl_product` WHERE pd_id = $pd_id") or die ("Could not query because: " . mysql_error());
print "<select name=\"selecticon\" id=\"selecticon\">";
print "<option value=\"none\" selected>Please select</option>";
while($row = mysql_fetch_array($sql)){
print "<option value=".$row['icon1'].">".$row['icon1']."</option>";
if ((!empty($row['icon2']))) {
print "<option value=".$row['icon2'].">".$row['icon2']."</option>";
}
if ((!empty($row['icon3']))) {
print "<option value=".$row['icon3'].">".$row['icon3']."</option>";
}
if ((!empty($row['icon4']))) {
print "<option value=".$row['icon4'].">".$row['icon4']."</option>";
}
}
print "</select>";
}
mysql_close();
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.