Drop Down Menu not posting values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mlevit
    New Member
    • Jun 2007
    • 30

    #1

    Drop Down Menu not posting values

    Hey all,

    This is really simple but I just can't get it work. I have a drop down menu, you select your filter which will repost to the same page and grab that filter which will be used for an SQL query.

    [PHP] $filter = $_POST['selectedFilter '];

    if ($filter == "" || $filter == "All")
    {
    $query = "SELECT * FROM orders WHERE orderStatus = 'New'";
    }
    else
    {
    $query = "SELECT * FROM orders WHERE orderStatus = 'New' AND reviewType = '" . $filter . "'";
    }

    $result = mysql_query($qu ery);

    ?>
    <form action="orders. php" method="post">
    <select name"selectedFi lter">
    <option value="">Review filter</option>
    <option value="All">All </option>
    <option value="Free">Fr ee</option>
    <option value="Visual"> Visual</option>
    <option value="Content" >Content</option>
    <option value="Full">Fu ll</option>
    </select>
    <input type="submit" class="button2" value="Submit" />
    </form>
    <?php[/PHP]

    When I use a GET method I can see the value in the address bar but I still can't access it with $_GET (it just comes up empty).

    And that's the same with the $_POST it's not coming up with any value in the post. I've tried posting to another PHP file and I can get the same, the POST value is empty.

    Any ideas?

    Thanks
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    In orders.php, write this in the starting and see what it shows.[php]<?php
    echo "<pre>";
    print_r($_POST) ;
    echo "</pre>";
    ?>[/php]

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      You've missed the equals sign (=) out in the select name=

      [code=html]
      <select name="selectedF ilter">
      [/code]

      :) regards.

      Comment

      • mlevit
        New Member
        • Jun 2007
        • 30

        #4
        Originally posted by markusn00b
        You've missed the equals sign (=) out in the select name=

        [code=html]
        <select name="selectedF ilter">
        [/code]

        :) regards.
        OMG I don't know how I missed that :) I'm amazed it never came up as an error in the browser.

        Any ways, thanks for the help.

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5
          Originally posted by mlevit
          OMG I don't know how I missed that :) I'm amazed it never came up as an error in the browser.

          Any ways, thanks for the help.
          It happens!

          See you around.

          Regards, markus.

          Comment

          Working...