Jump to content

want to make table sortable..


Thundarfoot

Recommended Posts

I am displaying the contents of a mysql table, in a html format table.

 

I would like to make the columns sortable by the user. I would like a drop box type selection in place of the current column name.

 

I realize this may be beyond the scope of a simple post exchange, however any advice or help is mucho appreciated.

Link to comment
Share on other sites

Hi,

 

In column header you want to have dropdown ???

 

consider:

Name Age

ads    12

dzd    22

 

now in column on eyou would be having a drop down with Name and Age??

 

i would say this is not the better view with design rather you can creae column headers as clickable links which sort the data on click.

 

Regards

Link to comment
Share on other sites

Using your example, I would like to be able to click on Age and be able to choose from option to show

1. 0-9

2. 10-20

3. 21-100

 

Thanks

 

Thats what i query you for? that waa suggestion that if you want to simply sort data in table according to your header name.You didn't put up that you want parameters also attached with search results.

Well with this case you need to go your way but still putting drop down in place of column header is not suggestable either you can make bit more flexible that

when you click you column header user will be able to see the drop down box with your search parameter.so he knows what he is searching and the parameter he is trying.

 

Regards

 

 

 

 

Link to comment
Share on other sites

Try something like this

<form id="form1" name="form1" method="get" action="">
  <select name="select">
    <option value="0-9">0-9</option>
    <option value="10-20">10-20</option>
    <option value="21-100">21-100</option>
  </select>
  <input type="submit" value="Show" />
</form>
<?php
$age=$_GET['age']
$age=explode('-',$age);
$query='SELECT * FROM `people` WHERE `age` > \''.$age[0].'\' AND `age` < \''.$age[1].'\';';
$result=mysql_query($query);
//do something

?>

 

Scott.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.