mattyt81 Posted October 6, 2011 Share Posted October 6, 2011 Hi I have two html multi list boxes side by side, in the left box which has an ID of venueFrom I have the options (<option></option>). The right box which has an ID of venue is blank. I am using javascript to move selections from (venueFrom) to (venue) which works fine. When I hit submit the selections get submitted to mysql table and are stored in the relevant field which is venue. The problem I can't seem to fix is keeping the selected data in the (venue) multi list box after it has been submitted. I have tried various bits of code they I have written and other people have suggested but it doesn't work. I am currently at work so unable to paste all the code, but I think there should be enough information here. The field in mysql table that (venue) is being stored in, is a text field, I don't think this should matter, but I am not a PHP expert. Any help will be appreciated as its someonthing I should have sorted out myself by now, ut just can't crack it! Quote Link to comment https://forums.phpfreaks.com/topic/248549-php-code-help/ Share on other sites More sharing options...
xProteuSx Posted October 6, 2011 Share Posted October 6, 2011 Here's how I would do it: I would declare two variables: $venue and $venueFrom. I would make them empty strings, like this: $venue = $venueFrom = ''; Then I would collect the POST values of the two drop down menus: $venue = $_POST['venue']; $venueFrom = $_POST['venue']; Then, in the drop down menu I would add the following: <select> <?php if ($venue != '') {echo '<option>' . $venue . '</option>';} ?> <option>Milk</option> <option>Coffee</option> <option>Tea</option> </select> I'm pretty brain dead at the moment, but that's how I've done it in the past, I think. Good luck. Quote Link to comment https://forums.phpfreaks.com/topic/248549-php-code-help/#findComment-1276443 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.