Jump to content


Photo

Will not display combo boxes???


  • Please log in to reply
No replies to this topic

#1 cturner

cturner
  • Members
  • PipPipPip
  • Advanced Member
  • 148 posts
  • LocationMy computer

Posted 30 October 2006 - 07:11 AM

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

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();





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users