Drop Menu

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Drop Menu

    how to make a drop menu stay selected and i dnt have to re-select everytime i update my profile..for example


    echo "<b>Gender</b>:<br/>";

    echo "<select name=\"sex\">";


    echo "<option value=\"N/A\" >N/A</option>";



    echo "<option value=\"Male\" >Male</option>";

    echo "<option value=\"Female\" >Female</option>";

    echo "</select>";

    if i select male how do i make it stay at that one?

    #2
    Originally posted by wap_king View Post
    how to make a drop menu stay selected and i dnt have to re-select everytime i update my profile..for example


    echo "<b>Gender</b>:<br/>";

    echo "<select name=\"sex\">";


    echo "<option value=\"N/A\" >N/A</option>";



    echo "<option value=\"Male\" >Male</option>";

    echo "<option value=\"Female\" >Female</option>";

    echo "</select>";

    if i select male how do i make it stay at that one?
    you can use cookies to save which options user has selected.
    Advertise your mobile site for FREE with AdTwirl

    Comment


      #3
      use

      selected="selected"

      Comment


        #4
        Gum i dont knw cookie and something else i used selected and it didnt work can u give me an example ?

        Comment


          #5
          cant remember ibwf_users sql but something like this:
          PHP Code:
          $sex mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE id='".$who."'"));

          echo 
          "<b>Gender</b>:<br/>";
          echo 
          "<select name=\"sex\">";
          echo 
          "<option value=\"N/A\" >N/A</option>";
          if(
          $sex[0]=="Male"){
          echo 
          "<option value=\"Male\"  selected=\"selected\">Male</option>";
          }else{
          echo 
          "<option value=\"Male\">Male</option>";
          }
          if(
          $sex[0]=="Female"){
          echo 
          "<option value=\"Female\"  selected=\"selected\">Female</option>";
          }else{
          echo 
          "<option value=\"Female\" >Female</option>";
          }
          echo 
          "</select>"
          or something simular to it :P

          Comment


            #6
            i think i tried sumting like that and it didnt work mayb i missed sumting let me try that......even thou i see ibwf_users there so i guess thats lavav coding dnt think its gonna work on my script got 2 recode that

            Comment


              #7
              hey i got it thanx.....for the help something else

              Comment


                #8
                Your Welcome

                Comment


                  #9
                  Am having problem with this one thou......check it out


                  echo "<b>Looking For</b>:<br/>";

                  echo "<select name=\"looking\">";

                  echo "<option value=\"N/A\" >N/A</option>";

                  $data = mysql_fetch_assoc(mysql_query("select * from pg_user where login ='$user'"));

                  if($data['looking[0]']=="1"){
                  echo "<option value=\"1\" selected=\"1\">Dating</option>";
                  }else{
                  echo "<option value=\"1\">Dating</option>";

                  }

                  if($data['looking[0]']=="2"){
                  echo "<option value=\"2\" selected=\"2\">Serious Relationship</option>";
                  }else{
                  echo "<option value=\"2\" >Serious Relationship</option>";
                  }

                  if($data['looking[0]']=="3"){
                  echo "<option value=\"3\" selected=\"3\">Friends</option>";
                  }else{
                  echo "<option value=\"3\" >Friends</option>";
                  }



                  echo "</select>";

                  Comment


                    #10
                    Providing the variable $user is defined should be something like this:
                    PHP Code:
                    echo "<b>Looking For</b>:<br/>"
                    echo 
                    "<select name=\"looking\">"
                    echo 
                    "<option value=\"N/A\" >N/A</option>"
                    $data mysql_fetch_assoc(mysql_query("select looking from pg_user where login ='".$user."'"));
                    if(
                    $data[0]=="1"){ 
                    echo 
                    "<option value=\"1\" selected=\"1\">Dating</option>"
                    }else{ 
                    echo 
                    "<option value=\"1\">Dating</option>"

                    }
                    if(
                    $data[0]=="2"){ 
                    echo 
                    "<option value=\"2\" selected=\"2\">Serious Relationship</option>"
                    }else{ 
                    echo 
                    "<option value=\"2\" >Serious Relationship</option>"
                    }
                    if(
                    $data[0]=="3"){ 
                    echo 
                    "<option value=\"3\" selected=\"3\">Friends</option>"
                    }else{ 
                    echo 
                    "<option value=\"3\" >Friends</option>"

                    echo 
                    "</select>"

                    Comment


                      #11
                      nope thats not gonna work...thanx for trying......

                      Comment

                      Working...
                      X