Jump to content

beginner101

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by beginner101

  1. I am working on a website with my project mates, in which I need to add a filter dropdown box. When I select one of the option in it, the table being displayed in that webpage will display a different set of data based on the type of data I selected to filter. Also this webpage can only be seen by logging in as a valid user.

     

    I am very new to javascript and php programming and after going through several forums, I added the following code as a start to do the filtering, by which the webpage will be able to get the dropdown box option that was selected and display it:

     

     

    <script>
    function formSubmit()
    {
    document.getElementById("report_filter").submit();
    }
    </script>
    
    <form method="POST" id="report_filter" action="" >
    <select name="try" onchange="formSubmit();">
    <option value="all">All</option>
    <option value="Windows">Windows</option>
    <option value="Win 2008">Win 2008</option>
    <option value="Win 7">Win 7</option>
    <option value="Win Vista">Win Vista</option>
    <option value ="Linux">Linux</option>
    <option value = "Win 7/Linux">Win 7/Linux</option>
    </select>
    </form>
    
    <?php
    
    if(!(isset($_POST["try"])))
    {
      echo "none";
    }
    else
    echo $_POST["try"];
    
    ?>

    The code above works ok when i run that individually in a separate php page, i.e., it ehoes the option that i select in the drop down box. But not so when I add it to the webpage that I am working on, cause when I select an option in the dropdown box the page goes blank and nothing else happens.

×
×
  • 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.