Jump to content

Why is this not showing correctly?


Navajo

Recommended Posts

Why is it all messed up, I want two drop down menu's which show identical things.

 

Why is the first one fine and the second is messed up?

 

<FORM ACTION="calculate.php" METHOD="POST" onSubmit="return dropdown(this.display)">


<SELECT NAME="display">
<OPTION VALUE="">Choose a Product
<?php
  
while ($row = mysql_fetch_array($result)) {
extract($row);
$productID = $row['vchar_product_id'];
$assesmentLimit = $row['vchar_assessment_limit'];

?>
<OPTION VALUE=<?php "$productID, $assesmentLimit"?> > <?php echo "$productID $assesmentLimit" ?>
<?php
//}
?>
</SELECT>


<SELECT NAME="display2">
<OPTION VALUE="">Choose a Product2
<?php


?>
<OPTION VALUE=<?php "$productID, $assesmentLimit"?> > <?php echo "$productID $assesmentLimit" ?>
</SELECT>

<?php
}
?>
<br /><br /><br /><br />
<INPUT TYPE=SUBMIT VALUE="Calculate">
</FORM>

Link to comment
https://forums.phpfreaks.com/topic/147017-why-is-this-not-showing-correctly/
Share on other sites

Along side that here is a corrected version, you need to use " around values in html or you get errors:

 

<OPTION VALUE="<?php echo "$productID, $assesmentLimit"; ?>"> <?php echo "$productID $assesmentLimit"; ?></OPTION>

 

And it is also good practice to have the </option> Not required, just good practice.

Archived

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

×
×
  • Create New...

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.