SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: blank field

  1. #1
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    blank field

    Hi guys

    What I want to do is when I fill my dropdown box to skip the sublocation boxes
    which are empty how can i do this



    cat_id :Avon
    sublocation :Bath
    sublocationshow:Bath

    cat_id :Avon
    sublocation :
    sublocationshow:All Avon Sub Locations

    PHP Code:
        <select id="sublocation" name="sublocation">
            
      <option value="">Sub Location</option>

      <?
    while($noticia3 mysql_fetch_array($quer2)) { 


    if(
    $noticia3['sublocation']==$sublocation){echo "<option selected value='$noticia3[sublocation]'>$noticia3[sublocationshow]</option>"."<br />";}

    else{echo  
    " <option value='$noticia3[sublocation]'>$noticia3[sublocationshow]</option>";}

    }
    ?>

            </select>

  2. #2
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this isn't a mysql question, you want to have this answered in the php forum. ask a moderator to move your question.

  3. #3
    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:
    <select id="sublocation" name="sublocation">
    <option value="">Sub Location</option>

    <?php

    while($noticia3 mysql_fetch_array($quer2)) { 

      if (
    $noticia3['sublocation'] == $sublocation) {
        echo 
    "<option selected value='$noticia3[sublocation]'>$noticia3[sublocationshow]</option><br />";
      } elseif (!empty(
    $noticia3['sublocation'])) {
        echo 
    "<option value='$noticia3[sublocation]'>$noticia3[sublocationshow]</option>";
      }

    }
    ?>

    </select>


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
  •