Navajo Posted February 26, 2009 Share Posted February 26, 2009 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> Quote Link to comment https://forums.phpfreaks.com/topic/147017-why-is-this-not-showing-correctly/ Share on other sites More sharing options...
Mchl Posted February 26, 2009 Share Posted February 26, 2009 Both are messed up: <OPTION VALUE=<?php "$productID, $assesmentLimit"?> > <?php echo "$productID $assesmentLimit" ?> there should be 'echo' in the first <?php tag Quote Link to comment https://forums.phpfreaks.com/topic/147017-why-is-this-not-showing-correctly/#findComment-771815 Share on other sites More sharing options...
Navajo Posted February 26, 2009 Author Share Posted February 26, 2009 thanks, but that makes no difference to the result? Quote Link to comment https://forums.phpfreaks.com/topic/147017-why-is-this-not-showing-correctly/#findComment-771818 Share on other sites More sharing options...
Mchl Posted February 26, 2009 Share Posted February 26, 2009 Still, this was an error. What is the HTML produced by this code? Quote Link to comment https://forums.phpfreaks.com/topic/147017-why-is-this-not-showing-correctly/#findComment-771821 Share on other sites More sharing options...
premiso Posted February 26, 2009 Share Posted February 26, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/147017-why-is-this-not-showing-correctly/#findComment-771888 Share on other sites More sharing options...
Mchl Posted February 26, 2009 Share Posted February 26, 2009 And if you're about to populate two drop downs, you will need to use two separate loops. The way you do it now, I'm surprised it shows even the first one correctly. Quote Link to comment https://forums.phpfreaks.com/topic/147017-why-is-this-not-showing-correctly/#findComment-771952 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.