Retrieve records with $_POST
<p>I have a bit of a problem. I have a navbar</p>

<pre><code>|  home  |  view  |  view(active)  |  view(deleted)  | 
</code></pre>

<p>When I click on view, I am taken to <code>view.php</code> which just retrieves all database records with:</p>

<pre><code>SELECT * FROM inventory  
</code></pre>

<p>In my inventory table, I have a column called <code>status</code> that has a value of either <code>y</code> or <code>n</code>. (<code>y</code> for active, <code>n</code> for not active (or deleted)).  </p>

<p>When I click on the <code>view(active)</code> and <code>view(deleted)</code> links I want to execute different queries, such as these:  </p>

<pre><code>SELECT * FROM inventory WHERE status LIKE 'y' (for retrieval of active records)  
SELECT * FROM inventory WHERE status LIKE 'n' (for retrieval of deleted records)  
</code></pre>

<p>It works fine if I attach <code>?view=y</code> to the end of my <code>view.ph</code>p link. The form action of my form references itself (<code>view.php</code>) except with the view type attached to it: <code>?view=y</code> or <code>?view=n</code> and then having conditionals determine which mysql query to execute. However, I would like to handle this situation with POST and it's not working. I don't want any values in my URL. Works just fine with <code>$_GET</code> though.</p>

<p>Thanks.</p>

<p><strong>CODE (view.php conditionals for queries)</strong> </p>

<pre><code>    if ($_POST['view'] == "y") {
        $result = mysql_query("SELECT * FROM inventory WHERE status LIKE 'y'"); }
    else if ($_POST['view'] == "n")  {
        $result = mysql_query("SELECT * FROM inventory WHERE status LIKE 'n'"); }
    else if ($_POST['submit'] == "search") {
        $result = mysql_query("SELECT * FROM inventory WHERE descrip LIKE '%$searchString%'"); }
    else {
        $result = mysql_query("SELECT * FROM inventory"); }
</code></pre>

<p><strong>CODE (my navigation bar)</strong>    </p>

<pre><code>&lt;div id="navigation"&gt;
    &lt;a href="add.php"&gt;&lt;input type="button" value="ADD" /&gt;&lt;/a&gt;
    &lt;a href="view.php"&gt;&lt;input type="button" value="VIEW" /&gt;&lt;/a&gt;
    &lt;a href="view.php?view=y"&gt;&lt;input type="button" value="view active" /&gt;&lt;/a&gt;
    &lt;a href="view.php?view=n"&gt;&lt;input type="button" value="view deleted" /&gt;&lt;/a&gt;
    &lt;div&gt;&lt;br /&gt;
        &lt;form action="view.php" method="POST"&gt;
            &lt;input type="text" name="searchDescription" id="search" placeholder="search for text in description" value="&lt;?php echo $_POST['searchDescription']; ?&gt;"/&gt;
            &lt;input type="submit" value="SEARCH" name="submit" id="searchDescriptionButton" /&gt;
        &lt;/form&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>
