SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    conditional drop menu options

    Im trying to get if $colora isn't empty then the link option shows, and same for $colorb

    PHP Code:
     <?php $form '<form name="form1">
                  <div align="right">
                    <select name="menu1" onChange="MM_jumpMenu(\'parent\',this,0)"> 
                      <option value="" selected>'
    .$color.'options</option>'
                      
    if ($colora <>'')'<option value="pastel-'.strtolower(str_replace(" ""-"$colora)).''.(strtolower($DUPE)).'.php">'.$colora.' sets</option>';
                      if (
    $colorb <>'')'<option value="pastel-'.strtolower(str_replace(" ""-"$colorb)).''.(strtolower($DUPE)).'.php">'.$colorb.' sets</option>';          
        
    '</select>
                  </div>
                </form>'
    ;?>
    Please ignore the $DUPE's - these are custom tags set only for a few certain variables.

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php 
    $form 
    '<form name="form1">
                  <div align="right">
                    <select name="menu1" onChange="MM_jumpMenu(\'parent\',this,0)"> 
                      <option value="" selected>'
    .$color.'options</option>';

    if (!empty(
    $colora)) {
        
    $form .= '<option value="pastel-'.strtolower(str_replace(" ""-"$colora)).''.(strtolower($DUPE)).'.php">'.$colora.' sets</option>';
    }
    if (!empty(
    $colorb)) {
        
    $form .= '<option value="pastel-'.strtolower(str_replace(" ""-"$colorb)).''.(strtolower($DUPE)).'.php">'.$colorb.' sets</option>';          
    }

    $form .=    '</select>
                  </div>
                </form>'
    ;
    ?>

  3. #3
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dan Grossman,

    I'm only getting the first echoed row out of that.

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    There are no rows in your code or description. Please explain more thoroughly.

  5. #5
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry,

    okay, if the $color is set to Blue on the page (along with a $colora and $colorb) the source code amounts to:

    PHP Code:
    <form name="form1">
    <
    div align="right">
    <
    select name="menu1" onChange="MM_jumpMenu('parent',this,0)"
    <
    option value="" selected>Blue options</option


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •