Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

sort button

General discussions related to php

Moderators: macek, egami, gesf

sort button

Postby kanonyqkaskdn » Fri Apr 12, 2013 6:00 am

can I make a sort button in php??
for example, when the user click the button, the name of food will be sorting ascending. In addition, when the user click the button again, the name of food will be sorting descending.
kanonyqkaskdn
New php-forum User
New php-forum User
 
Posts: 5
Joined: Mon Apr 08, 2013 6:01 am

Re: sort button

Postby seandisanti » Fri Apr 12, 2013 1:25 pm

yes and no. It can be done as you describe if you make use of javascript, either with just javascript, jquery, or ajax. Any of those (they're basically all the same thing implemented differently) will allow you to respond to user input without having to reload the page. to do the same with JUST php and markup, you'd have to make it a form, with a sort_by to order the records on. The button would be submit button (or link if you feel like using GET variables instead of POST) pointing the post of the form back to itself, with the sort variable changed. It can be done so that it refreshes smoothly, but jquery would probably be the quickest and easiest way to get what you want.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 787
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.