Jump to content

Leigh79

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Posts posted by Leigh79

  1. Hope someone can help me...

    I have an insert form where several of the dropdown menus have values which are generated by pulling file contents (images) in to an array:


    [code]
    <?php
    //Looks into the directory and returns the files, no subdirectories
        echo "<select name='Photo1'>";
    echo "<option value='NA'>NA</option>";
    //The path to the style directory
        $dirpath = "../images/properties/";
        $dh = opendir($dirpath);
          while (false !== ($file = readdir($dh))) {
    //Don't list subdirectories
              if (!is_dir("$dirpath/$file")) {
    //Truncate the file extension and capitalize the first letter
              echo "<option value='$file'>$file</option>";
      }
    }
        closedir($dh); 
    //Close Select
    echo "</select>";
    ?>
    [/code]
    I'm now building an edit page and I need to set the value of the dropdown according to whats in the database, the code for which would be this:

    [code]
    <?php if (!(strcmp(0, $row_RS_Listing['Photo1']))) {echo "SELECTED";} ?>
    [/code]
    can anyone tell me how to incorporate these 2 snippets?

    Thanks
    Leigh
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.