dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Need help with sourting drop down menus?

  1. #1
    Join Date
    Dec 2008
    Posts
    35

    Question Need help with sourting drop down menus?

    Hey everyone I'm one 100% if this is an HTML question but I really need help.

    I'm looking for a wordpress plug in that allows you to sort content with drop down menus. I'm not even sure what to be typing into google or the WP plugin search to look over available options.

    I'm building a website to help the local recovery community and I was hoping to find a something that sorts AA meetings by date, location, and meeting type. Here you can see the non-wordpress version of what I"m looking for in action:

    http://www.aalansingmi.org/mSelect.asp

    Thanks for the help!

    John

  2. #2
    Join Date
    Apr 2013
    Posts
    135
    Hi,
    <?php


    $opts = array( 1 => 'Decibel', 2 => 'Need');

    // the number before the word represents the option ID in the `product_options` table
    // the word after contains the displayed name of the dropdown box, which would usually be the same as the name

    //title of the box

    $heading = 'Quick Search';

    // you should not need to edit below this line
    //------------------------

    $mainhtml = ""; //the var to hold all of the html

    foreach ( $opts as $opt => $name) {

    unset($html);

    $html = "<tr><td width='161px'>
    $name
    </td></tr>
    <tr><td>
    <SELECT name='$opt' onchange='document.m_srch.submit();'>
    <OPTION value='not'>---</OPTION>";//print the name of the box and start the drop down

    $sql = "SELECT `products_options_values_id` from `products_options_values_to_products_options` WHERE `products_options_id`='$opt'";
    $res = tep_db_query($sql);// get the values of all the options for that catagory
    while($id = tep_db_fetch_array($res)){

    $optnamear = tep_db_query("SELECT `products_options_values_name` from `products_options_values` WHERE `products_options_values_id`='$id[products_options_values_id]'");

    $optname = tep_db_fetch_array($optnamear);

    //create the dropdown

    $html .= "<OPTION value='$id[products_options_values_id]' ";

    if($_GET[$opt] == $id['products_options_values_id']){
    $html .= "selected='selected'"; // if the product has already been selected keep it selected!
    }

    $html .= ">$optname[products_options_values_name]</OPTION>";


    }

    $mainhtml .= $html."</SELECT></td></tr>";



    }


    echo "<tr><td>
    <table border='0' width='100%' cellspacing='0' cellpadding='0'>
    <tr>
    <td height='14' class='infoBoxHeading'><img src='images/infobox/corner_left.gif' border='0' alt='' width='11' height='14'></td>
    <td width='100%' height='14' class='infoBoxHeading' align='center'>$heading &nbsp;</td>
    </tr>
    </table>
    <table border='0' width='100%' cellspacing='0' cellpadding='1' class='infoBox'>
    <tr><td>
    <table class='infoBoxContents'>
    <FORM name='m_srch' action='advanced_search_result.php' method='get'>
    <INPUT type='hidden' value='1' name='m_op'> <INPUT type='hidden' value='1' name='keywords'> \n
    $mainhtml
    </table>
    </td></tr>
    </FORM>
    </table>
    </td></tr>";

    ?>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles