hadiaruz Posted June 24, 2009 Report Share Posted June 24, 2009 Hello, I have a question regarding double dropdownlist. I have no problem in order to insert and save the data. the problem comes when on the update page, I would like to display again the value of the selected item, there is double value in the dropdown list. How to remove the double item in the drop down list ya? Appreciate your prompt response on this matter as i need to submit my project as soon as possible. Unit -------- <?= $row['unit']?> Unit 1 Unit 2 Unit 3 Unit 4 Unit 5 Unit 6 Unit 7 Unit 8 Officer --------- Officer in Charge: <?=$row['officer']?> Quote Link to comment Share on other sites More sharing options...
hadiaruz Posted January 15, 2010 Author Report Share Posted January 15, 2010 Hello everyone, i hope that somebody expert from this forum can help me solve this problem.. Thank you very much Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 15, 2010 Report Share Posted January 15, 2010 To be honest, I'm not completely sure I understand what you are trying to do. If you are trying to set the dropdown so that the selected value is correct, here is what I have done in the past: Please select >Option 1 >Option 2 >Option 3 This assumes that I've set a PHP variable named "data" to hold the selected value. When I create the , I check if the $data variable is set (this makes sure that the dropdown should hold a value, if it is blank, none of the dropdown items are selected) and then check if the $data value is equal to the option's value. If so, I echo out "selected='selected'" which makes that item selected. Make sense? Quote Link to comment 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.
Note: Your post will require moderator approval before it will be visible.