How 2 create a dynamic list/menu from a list/menu that is not dynamic?

The page in question is: And the part that needs solving is the "Choose a Property Type" field.

Currently this Property Type field has these categories:Acreage; Commercial: Farm; Lot; Multi-Family; Residential; Townhouse.

When the office manager at Century 21 Real Estate Unlimited goes in to edit a property listing, all of the information loads in correctly except the Property Type box. She has to go and reselect the property type.

I want the problem to be solved such that she doesn't have to reselect it - the property type loads in as does the other information.
Who is Participating?
humeniukConnect With a Mentor Commented:
The objective is to have the result stored in the database appear as a pre-selected choice in the drop-down menu.  To do this in Dreamweaver: select the drop-down menu so that the properties window appears, click the 'Dynamic' button to bring up the 'Dynamic List/Menu' window.  In the 'Dynamic List/Menu' window, click little button with the lightning symbol beside the 'Select Value Equal To' field - this will bring up the 'Dynamic Data' winsow with the recordset applicable to that form.  Scroll down to find the recordset value you want (ie. property_type or whatever it's called in your database table), select it and click OK.

Here is an example of the code generated from a PHP/MySQL real estate site I developed:

<select name="Property Type" id="property_type">
<option value="Detached" <?php if (!(strcmp("Detached", $row_rsListings['type']))) {echo "selected";} ?>>Detached</option>
<option value="Semi-Detached"   . . .   etc.
The syntax should be the same as it is for the 'Select Agent Name' field as they are both the same kind of menu.  Is 'Select Agent Name' working?
To indicate which item in the drop down is selected simply fill an array variable with the word "selected".

For instance;

Let's say that your query returned a value for the drop down of 2, Commercial.

You could write something like this..,

$returnedValue  =  $row['myField'];

$myArray[$returnedValue  =  'selected';

<select name="selMyDropDown">
    <option value="1" <?=$myArray[1]?>>Acreage</option>
    <option value="2" <?=$myArray[2]?>>Commercial</option>
    <option value="3" <?=$myArray[3]?>>Farm</option>

This will put selected in the value for $myArray[2] and the dropdown will show Commercial as the selected item when the page loads.
MaryAnnWalshAuthor Commented:
I do have an objection to the Administrative Comment from modulo.

The Forced Accept should not go to alexhogan {http:#13753729} because I could not use an array. I needed instructions that would pull information dynamically from a database.

The credit should go to the answer from: humeniuk {http:#13753844} because these are the instructions that work.

I realize I forgot about this posted question/answer of  Date: 04/11/2005 10:35AM EST
This post is within the four day time limit for my response to ask that the credit go to humeniuk who actually gave me the correct answer.

Mary Ann Walsh
It's good to know the info was helpful.  Thank you for the A.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.