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 8644669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:21:22+00:00 2026-06-12T12:21:22+00:00

I am creating a search form that uses multiple forms to get matching results

  • 0

I am creating a search form that uses multiple forms to get matching results from a database that contains meat packaging information. I want eventually for users to be able to use forms to search for the width, length, type, shape and description of a package. With only the matching results to be displayed.

Currently I have 3 dropdown boxes and all work and find matching results. Unfortunately they seem to completely override the other form terms (another problem), but I want to add in a “Any” function so users can search for anything without having to give a specific search for all the dropdown boxes everytime limiting the amount of results that will appear.

HTML code:

    <body>


    <form action="form3.php" method="post"> 
    <label for ="toolcode">Toolcode: </label> 
    <input type="text" name="term" /><br />
    <label for ="delyncode">Delyn code: </label>
    <input type="text" name="term" /><br />
    <label for ="description">Description: </label>
    <input type="text" name="term" /><br />
    <label for ="traysize">Traysize: </label>
    <input type="text" name="term" /> <br />
    <label for ="trayheight">Trayheight: </label>
    <input type="text" name="term" /> <br /> 
    <label for ="traywidth">Traywidth: </label>
    <input type="text" name="term" /> <br />
    <label for ="traydepth">Traydepth: </label>
    <input type="text" name="term" /> <br />

         <label for="trayrange">Trayrange: </label>
                <select name="trayrange">
                    <option value="Other">--Any--</option>
                    <option value="BBQ">BBQ</option>
                    <option value="Dessert">Dessert</option>
                    <option value="Display">Display</option>
                    <option value="Meat">Meat</option>   
                    <option value="Microwave">Microwave</option>
                    <option value="Party">Party</option>
                    <option value="Salad/Wet Pasta">Salad/Wet Pasta</option>
                    <option value="Snacks">Snacks</option>
                    <option value="Standard">Standard</option>
                </select>

        <label for ="traytype">Traytype: </label> 
                <select name="traytype">
                    <option value="Other">--Any--</option>
                    <option value="Open">Open</option>
                    <option value="Cavitised">Cavitised</option>
                    <option value="Lid">Lid</option>
                    <option value="Tray">Tray</option>
                    <option value="Coallition">Coallition</option>
                    <option value="Bowl">Bowl</option>
                    <option value="Hinge pack">Open</option>
                    <option value="Pot">Pot</option>
                    <option value="Base & Lid">Base and Lid</option>
                    <option value="Rectangular">Rectangular</option>
                    <option value="Specalist">Specialist</option>
                </select><br />

        <label for="trayshape">Trayshape: </label>
                <select name="trayshape">
                    <option value="Other">--Any--</option>
                    <option value="Rectangular">Rectangular</option>
                    <option value="Oval">Oval</option>
                    <option value="Square">Square</option>
                    <option value="Insert">Insert</option>
                    <option value="Round">Round</option>
                    <option value="Open">Open</option>
                </select><br />
        <input type="submit" value="Submit" /> 
    </form> 

      </body>

The current “Any” option i have above was just a test. It doesn’t work, no results get displayed.

PHP code:

       <body>

        <?php
            $con = mysql_connect ("localhost", "root", "");
                   mysql_select_db ("delyn_db", $con);

            if (!$con)
                { 
                    die ("Could not connect: " . mysql_error());
                }

            $varRange = $_POST['trayrange'];
            $varType = $_POST['traytype'];
            $varShape = $_POST['trayshape'];
            $term = mysql_real_escape_string($_POST['term']);    

    $sql = "SELECT * FROM delyn WHERE toolcode LIKE '%".$term."%' AND delyncode LIKE
                   '%".$term."%' AND description LIKE '%".$term."%' AND traysize LIKE
                   '%".$term."%' AND trayheight LIKE '%".$term."%' AND traywidth LIKE
                   '%".$term."%' AND traydepth LIKE '%".$term."%' AND trayrange LIKE
                   '%".$varRange."%' AND traytype LIKE '%".$varType."%' AND trayshape LIKE
                   '%".$varShape."%' ";


            $r_query = mysql_query($sql);


        while ($row = mysql_fetch_array($r_query))
                    { 
               echo '<br /> Delyn code:  ' .$row['delyncode']; 
           echo '<br /> Tool Code:   '.$row['toolcode'];
           echo '<br /> Description: '.$row['description']; 
           echo '<br /> Tray range   '.$row['trayrange']; 
           echo '<br /> Tray type:   '.$row['traytype'];
           echo '<br /> Tray size:   '.$row['traysize']; 
           echo '<br /> Tray height: '.$row['trayheight']; 
           echo '<br /> Tray width:  '.$row['traywidth']; 
           echo '<br /> Tray depth:  '.$row['traydepth'];
           echo '<br /> Tray shape:  '.$row['trayshape'] . '<br />' . '<br />'; ;  
                    }


        ?>
            </body>

What would I need to add to allow the users to search allowing for any “tray range”, “trayshape” and “traytype”. This in theory should display results that match the forms that have info entered.

Thanks in advance for anyone who can help.

  • 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-12T12:21:24+00:00Added an answer on June 12, 2026 at 12:21 pm

    use different names for different text-fields otherwise they will be overwritten i.e the last text got preferred at server side you will get tray width only because its the last one with name term

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

Sidebar

Related Questions

I am creating a multi-form search box that searches a Meat packaging database. The
I am creating a multi-form search box that searches a Meat packaging database. The
I'm creating a form that allows the user to search a database for different
I am creating a search form for a packaging database and I have used
Seems simple enough. I'm creating a search engine that returns results to the user
I'm creating eBay style search panes that allow users to narrow their results set
I'm creating a set of search panes that allow users to tweak their results
I'm creating a custom search form and when I try and sort the results
Following on from a recent post. I am creating a search function that queries
I'm creating a search page, the page has a form that is being submitted

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.