sort table by dropbox entry

sort table by dropbox entry

Hi All, I current have the following code, apologies for the length. I am able to retrieve all the information i require but am looking to include some filter boxes. I have managed to add the filter drop down to the table BUT and am unable to get this to do anything. The dropdown pulls its data from another dedicated table(works) but I need an OnCHANGE event to filter the data where the Country equals the selected record in the dropdown?? (#95 are underscores in the code below) I can manually add the following into the $sql= ... AND Country='BE' and it will find all records for that country.. can this be done dynamically or with a page reload??? Any help gratefully received:

<?php
require './connections/db_connect.php';

$db_name="Projects_Main"; // Database name 
$tbl_name="Main"; // Table name

// Connect to server and select database.
mysql_connect($host, $usrname, $pssword)or die("Connection failed"); 
mysql_select_db($db_name)or die("Connection failed");
$sql=("SELECT * FROM $tbl_name WHERE Status not like 'CLOSED'");
$result=mysql_query($sql);

$num_rows = mysql_num_rows($result);
$fields_num = mysql_num_fields($result);

?>
<table>

<!-- create the table headers and using the next section build the table. sections not shown as page space not sufficent -->
<tr>
    <th>Project ID</th>
    <th>Financial Year</th>
    <th>Country</th>
    <th>More Details</th>
    <th>UPDATE</th>
</tr>
<!--START:filter    NOT WORKING-->
<tr>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th>
        <?php
            $db_name = 'Projects_Main';
            $ctrytable = 'Country';
                if (!mysql_connect($host, $usrname, $pssword))
                       die("Can't connect to database 'cos somethin' is wrong");
                if (!mysql_select_db($db_name))
                     die("Can't select database");
            $result1 = mysql_query("SELECT country_abbrev, country_name FROM {$ctrytable} order by country_name");
            $options="";
        while ($row=mysql_fetch_array($result1)) 
                {
                    $id=$row["country_abbrev"];
                    $thing=$row["country_name"];
                    $options.="<OPTION VALUE=\"$id\">".$id."</option>\n";
                }
        ?>
            <SELECT NAME="Country" type="text" onchange="filterTable(this.options[this.selectedIndex].value);">
                <OPTION VALUE=\"\">ALL
                                        <? echo $options?>
            </SELECT>
    </th>

    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
</tr>
<!--END:  filter -->

    <?php

    while($rows=mysql_fetch_array($result))
    {


    ?>
<!-- echo the contents of database table -->
<tr>
    <td align="center"><?php echo $rows['Project_id']; ?></td>
    <td><?php echo $rows['FinancialYear']; ?></td>
    <td><?php echo $rows['Country']; ?></td> 
    <!-- link to show more info on the record or update record.. -->
    <td><a href="./projects_more.php?Project_id=<?php echo $rows['Project_id']; ?>">more...</a></td>
    <td><a href="./projects_update.php?Project_id=<?php echo $rows['Project_id']; ?>">update</a></td>
</tr>
    <?php
    }
    ?>
</table>

<?php
mysql_close();
?>
View Answers









Related Tutorials/Questions & Answers:
sort table by dropbox entry
sort table by dropbox entry  Hi All, I current have the following... drop down to the table BUT and am unable to get this to do anything. The dropdown pulls its data from another dedicated table(works) but I need an OnCHANGE
JavaScript sort table
JavaScript sort table..., we are going to sort the table using the JavaScript. To sort the table, we... file, we have created a for loop which iterates through the rows of the table
Advertisements
How to add dropdown list in a row of a sort table applet?
How to add dropdown list in a row of a sort table applet?  How to add dropdown list in a row of a sort table applet
How to Sort Column values of a jsp table - JSP-Servlet
How to Sort Column values of a jsp table  Hi Friend Please help me. I am displaying reultset values on multiple jsp page. I want to sort selected column values on every page onclick of an event its very urgent pleasehelp
Sort
Sort  program to sort a list of numbers in decendimg order   Hi Friend, Try the following code:ADS_TO_REPLACE_1 import java.util.*; class SortListInDescendingOrder{ public static void main(String[] args
Mysql Date Sort
; Mysql Date Sort is used to return the sort  records or rows value in table... from Mysql Date Sort. To understand this example, we create a table 'employee1... to sort data from the table according to Empname created:- The Query return you
Sort
all the votes have been counted, the program should output a table showing how
ModuleNotFoundError: No module named 'dropbox'
ModuleNotFoundError: No module named 'dropbox'  Hi, My Python... 'dropbox' How to remove the ModuleNotFoundError: No module named 'dropbox... to install padas library. You can install dropbox python with following command
database entry using jdbc
database entry using jdbc  Give me a program to enter records in table using jdbc in java.   Hi Friend, Please visit the following link:ADS_TO_REPLACE_1 Insert data into database Thanks
Version of com.fathzer>jclop-dropbox dependency
List of Version of com.fathzer>jclop-dropbox dependency
ModuleNotFoundError: No module named 'django-dropbox'
ModuleNotFoundError: No module named 'django-dropbox'  Hi, My... named 'django-dropbox' How to remove the ModuleNotFoundError: No module named 'django-dropbox' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'dropbox-filemanager'
ModuleNotFoundError: No module named 'dropbox-filemanager'  Hi, My... named 'dropbox-filemanager' How to remove the ModuleNotFoundError: No module named 'dropbox-filemanager' error? Thanks   Hi
ModuleNotFoundError: No module named 'dropbox-index'
ModuleNotFoundError: No module named 'dropbox-index'  Hi, My... 'dropbox-index' How to remove the ModuleNotFoundError: No module named 'dropbox-index' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'dropbox-master'
ModuleNotFoundError: No module named 'dropbox-master'  Hi, My... named 'dropbox-master' How to remove the ModuleNotFoundError: No module named 'dropbox-master' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'dropbox_tools'
ModuleNotFoundError: No module named 'dropbox_tools'  Hi, My... 'dropbox_tools' How to remove the ModuleNotFoundError: No module named 'dropbox_tools' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Flask-Dropbox'
ModuleNotFoundError: No module named 'Flask-Dropbox'  Hi, My... 'Flask-Dropbox' How to remove the ModuleNotFoundError: No module named 'Flask-Dropbox' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Flask-Dropbox'
ModuleNotFoundError: No module named 'Flask-Dropbox'  Hi, My... 'Flask-Dropbox' How to remove the ModuleNotFoundError: No module named 'Flask-Dropbox' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Flask-Dropbox'
ModuleNotFoundError: No module named 'Flask-Dropbox'  Hi, My... 'Flask-Dropbox' How to remove the ModuleNotFoundError: No module named 'Flask-Dropbox' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'ncdu-dropbox'
ModuleNotFoundError: No module named 'ncdu-dropbox'  Hi, My Python... 'ncdu-dropbox' How to remove the ModuleNotFoundError: No module named 'ncdu-dropbox' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'omero-dropbox'
ModuleNotFoundError: No module named 'omero-dropbox'  Hi, My... 'omero-dropbox' How to remove the ModuleNotFoundError: No module named 'omero-dropbox' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cloudwright-dropbox'
ModuleNotFoundError: No module named 'cloudwright-dropbox'  Hi, My... named 'cloudwright-dropbox' How to remove the ModuleNotFoundError: No module named 'cloudwright-dropbox' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-dropbox'
ModuleNotFoundError: No module named 'django-dropbox'  Hi, My... named 'django-dropbox' How to remove the ModuleNotFoundError: No module named 'django-dropbox' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'dropbox-api'
ModuleNotFoundError: No module named 'dropbox-api'  Hi, My Python... 'dropbox-api' How to remove the ModuleNotFoundError: No module named 'dropbox-api' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'dropbox_backup'
ModuleNotFoundError: No module named 'dropbox_backup'  Hi, My... named 'dropbox_backup' How to remove the ModuleNotFoundError: No module named 'dropbox_backup' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'dropbox-cli'
ModuleNotFoundError: No module named 'dropbox-cli'  Hi, My Python... 'dropbox-cli' How to remove the ModuleNotFoundError: No module named 'dropbox-cli' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'dropbox_compatiable'
ModuleNotFoundError: No module named 'dropbox_compatiable'  Hi, My... named 'dropbox_compatiable' How to remove the ModuleNotFoundError: No module named 'dropbox_compatiable' error? Thanks   Hi
ModuleNotFoundError: No module named 'dropbox-csp'
ModuleNotFoundError: No module named 'dropbox-csp'  Hi, My Python... 'dropbox-csp' How to remove the ModuleNotFoundError: No module named 'dropbox-csp' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'dropbox-filemanager'
ModuleNotFoundError: No module named 'dropbox-filemanager'  Hi, My... named 'dropbox-filemanager' How to remove the ModuleNotFoundError: No module named 'dropbox-filemanager' error? Thanks   Hi
ModuleNotFoundError: No module named 'dropbox-index'
ModuleNotFoundError: No module named 'dropbox-index'  Hi, My... 'dropbox-index' How to remove the ModuleNotFoundError: No module named 'dropbox-index' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'dropbox-master'
ModuleNotFoundError: No module named 'dropbox-master'  Hi, My... named 'dropbox-master' How to remove the ModuleNotFoundError: No module named 'dropbox-master' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'dropbox-sync'
ModuleNotFoundError: No module named 'dropbox-sync'  Hi, My Python... 'dropbox-sync' How to remove the ModuleNotFoundError: No module named 'dropbox-sync' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'dropbox_tools'
ModuleNotFoundError: No module named 'dropbox_tools'  Hi, My... 'dropbox_tools' How to remove the ModuleNotFoundError: No module named 'dropbox_tools' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Flask-Dropbox'
ModuleNotFoundError: No module named 'Flask-Dropbox'  Hi, My... 'Flask-Dropbox' How to remove the ModuleNotFoundError: No module named 'Flask-Dropbox' error? Thanks   Hi, In your python
delete an entry using JavaScript
delete an entry using JavaScript  How to delete an entry using JavaScript
Order Entry System
Order Entry System  Create a new order entry system using netbeans and microsoft access.can anyone help me
ModuleNotFoundError: No module named 'entry'
ModuleNotFoundError: No module named 'entry'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'entry' How to remove the ModuleNotFoundError: No module named 'entry'
Help With Costructing Selection sort?
Help With Costructing Selection sort?  Using a selection sort, for each entry in the array, display the original index of the first dimension... in advance!   Please visit the following link: Java Selection Sort
Array sort
Array sort  Program that uses a function to sort an array of integers
bubble sort
bubble sort  write a program in java using bubble sort
insertion sort
insertion sort  write a program in java using insertion sort
insertion sort
insertion sort  write a program in java using insertion sort
insertion sort
insertion sort  write a program in java using insertion sort
insertion sort
insertion sort  write a program in java using insertion sort
insertion sort
insertion sort  how many arrays needed for insertion sort and why
bubble sort
bubble sort  how to calculate the number of passes in bubble sort
Version of com.syncthemall>dropbox-java-sdk dependency
List of Version of com.syncthemall>dropbox-java-sdk dependency
table
table  multiplicatyion table
buble sort
buble sort  ascending order by using Bubble sort programm   Java BubbleSort Example
Edit cron entry
Edit cron entry   Hi, What is the command to Edit cron entry in linux? Regards Deepak Kumar   Hi, You can use the following command to open cron configuration in vi editor: crontab -e After editing just save
ModuleNotFoundError: No module named 'django-dropbox-redux'
ModuleNotFoundError: No module named 'django-dropbox-redux'  Hi...: No module named 'django-dropbox-redux' How to remove the ModuleNotFoundError: No module named 'django-dropbox-redux' error? Thanks   Hi

Ads