Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8713545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:22:04+00:00 2026-06-13T05:22:04+00:00

I have a bit of a problem. I have a navbar | home |

  • 0

I have a bit of a problem. I have a navbar

|  home  |  view  |  view(active)  |  view(deleted)  | 

When I click on view, I am taken to view.php which just retrieves all database records with:

SELECT * FROM inventory  

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

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

SELECT * FROM inventory WHERE status LIKE 'y' (for retrieval of active records)  
SELECT * FROM inventory WHERE status LIKE 'n' (for retrieval of deleted records)  

It works fine if I attach ?view=y to the end of my view.php link. The form action of my form references itself (view.php) except with the view type attached to it: ?view=y or ?view=n 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 $_GET though.

Thanks.

CODE (view.php conditionals for queries)

    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 (my navigation bar)

<div id="navigation">
    <a href="add.php"><input type="button" value="ADD" /></a>
    <a href="view.php"><input type="button" value="VIEW" /></a>
    <a href="view.php?view=y"><input type="button" value="view active" /></a>
    <a href="view.php?view=n"><input type="button" value="view deleted" /></a>
    <div><br />
        <form action="view.php" method="POST">
            <input type="text" name="searchDescription" id="search" placeholder="search for text in description" value="<?php echo $_POST['searchDescription']; ?>"/>
            <input type="submit" value="SEARCH" name="submit" id="searchDescriptionButton" />
        </form>
    </div>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:22:06+00:00Added an answer on June 13, 2026 at 5:22 am

    You can use hidden input types to pass POST parameters to your php script. There are a lot of more elegant solutions, but here is one that requires minimum code change.

    Add <input type="hidden" name="view" id="viewvalue"> in your form, and have your buttons call a javascript function that sets the value to y or n and submits the form.

    <script>
    function setView(wanted)
    {
       document.getElementById("viewvalue").value = wanted;
       document.getElementById("viewform").submit();
    }
    </script>
    

    Note that this function assumes that you have given the id viewform to your form.

    Then change the links in your buttons’ a href to javascript:setView('y') and javascript:setView('n), and you should be set.

    EDIT : Since you cannot use javascript, here is what it should look like

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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bit of a problem with my PHP code, I am assigning
I have a bit of problem with my function who just should return html
I have a bit of problem with this. I have a class A which
I have just started learning rails, tho i have a bit problem. I know
I have a bit of a problem around here, I just can't get it
I have a bit of problem when trying to validate my page as HTML5.
I have a bit of a problem that I can't seem to code my
I have a bit of a problem. I am trying to do the following
I have a bit of a problem building my project. I'm getting the bellow
I have a bit of a problem here. I have a third party ActiveX

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.