I have page with different view (list,folder and thumb view), each view has its sort button where you can sort it by asc and desc (a-z,z-a,old-new,new-old).
Since the default sort is a-z,
What i want to do is once i click the button z-a sort in list view then change to the other view(folder view), the sort mode in folder view also the same to the last click sort mode which is z-a.
But happened on my codes is every time i reload or change my page the sort mode always in default.
if($sort == 'asc'){
$sql = "SELECT * FROM tbl_files LEFT OUTER JOIN tbl_album_files ON tbl_files.file_id = tbl_album_files.file_id
WHERE media_type = 'video' ORDER BY file_name";
} else if ($sort == 'desc') {
$sql = "SELECT * FROM tbl_files LEFT OUTER JOIN tbl_album_files ON tbl_files.file_id = tbl_album_files.file_id
WHERE media_type = 'video' ORDER BY file_name DESC";
} else if ($sort == 'old') {
$sql = "SELECT * FROM tbl_files LEFT OUTER JOIN tbl_album_files ON tbl_files.file_id = tbl_album_files.file_id
WHERE media_type = 'video' ORDER BY DATE(ctime_datetime) asc, ctime_datetime asc ";
} else if ($sort == 'new') {
$sql = "SELECT * FROM tbl_files LEFT OUTER JOIN tbl_album_files ON tbl_files.file_id = tbl_album_files.file_id
WHERE media_type = 'video' ORDER BY DATE(ctime_datetime) desc, ctime_datetime desc ";
}
My codes can sort well but i want is every time i reload the page or go to other page the sort will remain the same that i click before the reload. Any Idea? TIA.