Hi, Thursday, June 12, 2003, 1:16:26 AM, you wrote: AM> I have a form with two dynamic dropdowns that submit the form when an AM> option is chosen. There is also a button at the bottom of the form that AM> submits the form.
AM> The first drop down is a list of all customers. The user chooses a AM> customer, and a query is run that populates all of the fields (mostly AM> text fields) of the form with that customer's data. There is another drop AM> down that contains a list of all of the conferences. I have the form AM> working enough that the conference in the drop down that is selected is AM> the conference that customer bought. The user should be able to edit AM> anything, including the conference, and push the button at the bottom to AM> save the changes. AM> So far, everything works correctly except for the second drop down - the AM> conference drop down. When the user picks a new conference from the drop AM> down, the form submits, but the option that is selected is not the option AM> the user just chose, but the one that is saved in the database. If I AM> change the if statement within the drop down code, I can get it to select AM> the new conference that the user selected, but then that particular AM> conference is always selected, no matter which customer is selected from AM> the first drop down, and it should change depending on what is in the AM> database. AM> I am trying to create an if statement that captures exactly what needs to AM> happen, but I am at a loss. Basically, any time a new name is chosen from AM> the drop down, the database value should be displayed. Otherwise, the AM> form value should be displayed. But I'm not sure how to determine if a AM> new name has been selected. You need to track the current customer in a hidden form field and do something like this: if(isset[$_POST['current_customer'])){ //someone pushed submit if($_POST['customer'] == $_POST['selected_customer']){ //same customer check if we have a new conf if(isset($_POST['conf'])){ $selected_conf = $_POST['conf']; }else{ $selected_conf = $database_conf; } }else{ $selected_conf = $database_conf; } else{ // first run so use defaults from database $current_customer = $database_cutomer; $selected_conf = $database_conf; } then in your select loops use $current_customer and $selected_conf to determin when to output "selected" Probably need to tweak the above but it is a start :) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php