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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:19:42+00:00 2026-06-04T01:19:42+00:00

I have made a filter function but I am having trouble with the starting

  • 0

I have made a filter function but I am having trouble with the starting table, I want all the data selected from a table to be displayed if no category is selected for the filter. So far, I can show all the necessary data needed if a category is chosen but only if a category is chosen. If none is chosen, it shows a blank table. Help please,…

Here’s the function

 function listhistoryHost(){
    $accountid=$_SESSION['userid'];
    if(isset($_POST['button'])){

    $filter=$_POST['historyfilter'];

    if($filter==$filter){
    $sql="select * from webhostrequest where status='$filter' order by webhostrequest.recentact desc";
    $result=mysql_query($sql) or die("Error in selecting items ".mysql_error());
        $out="<ul>";
            while($row=mysql_fetch_array($result)){

                $accountid=$row['userid'];
                $requesttitle=$row['requesttitle'];
                $requestid=$row['requestid'];

                echo "<table width=\"100%\" border=\"0\" cellpadding=\"2\">";
                echo "<tr class=\"rowcolor1\">";
                    echo "<td width=\"70%\"><span style=\"padding-left:20px\">Requested Web Hosting for  ".$row["requesttitle"]. "</td>";
                    echo "<td width=\"20%\"><span style=\"padding-left:20px\">Status: " .$row["status"]. "</td>";
                    echo "<td>
                    <center>
                        <form id = \"form1\" method = \"post\" action = \"viewhistorywebhost.php?webhost=$requestid\">
                            <input type = \"submit\" name = \"button\" id = \"button\" value = \"Details\" />
                        </form>
                    </center>";
                echo "</tr>";   
            }
            echo "</table>";
    return $out;
    }
    }
    }

Here’s the form and trigger

 <form id = "form1" method = "post" action = "#">
        <select id="select1" name="historyfilter">
        <option value='' selected disabled>Select item type</option>
            <?php
                $options = array('approved' => 'Approved',
                                'cancelled'=>'Cancelled',
                                'rejected' => 'Rejected');
                foreach($options as $value => $type){
                    echo "<option value=\"$value\">$type</option>";
                }
            ?>
        </select>   
            <input type = "submit" name = "button" id = "submit" value = "Go" />
        </form>
    <?php
        $webhost=new requisition2();
        echo $webhost->listhistoryHost();
    ?>
  • 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-04T01:19:44+00:00Added an answer on June 4, 2026 at 1:19 am

    Just put if condition for query

    function listhistoryHost(){
        $accountid=$_SESSION['userid'];
        if(isset($_POST['button'])){
    
        $filter=$_POST['historyfilter'];
        $sql="select * from webhostrequest order by webhostrequest.recentact desc";
        if(isset($filter))
           $sql="select * from webhostrequest where status='$filter' order by webhostrequest.recentact desc";
    
        $result=mysql_query($sql) or die("Error in selecting items ".mysql_error());
            $out="<ul>";
                while($row=mysql_fetch_array($result)){
    
                    $accountid=$row['userid'];
                    $requesttitle=$row['requesttitle'];
                    $requestid=$row['requestid'];
    
                    echo "<table width=\"100%\" border=\"0\" cellpadding=\"2\">";
                    echo "<tr class=\"rowcolor1\">";
                        echo "<td width=\"70%\"><span style=\"padding-left:20px\">Requested Web Hosting for  ".$row["requesttitle"]. "</td>";
                        echo "<td width=\"20%\"><span style=\"padding-left:20px\">Status: " .$row["status"]. "</td>";
                        echo "<td>
                        <center>
                            <form id = \"form1\" method = \"post\" action = \"viewhistorywebhost.php?webhost=$requestid\">
                                <input type = \"submit\" name = \"button\" id = \"button\" value = \"Details\" />
                            </form>
                        </center>";
                    echo "</tr>";   
                }
                echo "</table>";
        return $out;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a sample application which constructs a filter graph to capture audio
I have made a generic Observer interface and an Observable class, but can't compile
I have made a java project and want to deliver it to a client
I have made an application using Java/Hibernate/MySQL, but whenever I try running it, it
I have made a videochat, but as usual, a lot of men like to
I'm trying to add some functionality from a plugin I have made into a
Suppose I have a function (it really does what the name says): filter :
I have made a custom filter that is to fire on every action(request). So
I have made this nice little table: testPage.cfm: <html> <head> <title>Test Page</title> <style> .blue{
I am using preg_match function to filter unwanted characters from a textarea form in

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.