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

Posted on 2005-04-11
Last Modified: 2010-04-25
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.
Question by:MaryAnnWalsh
    LVL 33

    Expert Comment

    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?
    LVL 8

    Expert Comment

    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.
    LVL 33

    Accepted Solution

    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.

    Author Comment

    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
    LVL 33

    Expert Comment

    It's good to know the info was helpful.  Thank you for the A.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Suggested Solutions

    I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
    This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now