<?php
$query="select * from table order by date {$_REQUEST['qryorder']}";
.
.
.
.
.
.
?>
<form name=frm action='thispage.php'>
<select name=qryorder onchange='document.frm.submit()'>
<OPTION VALUE='asc'>Ascending
<OPTION VALUE='desc'>Descending
</SELECT>
</form>
.
.
.
.
.
or
<?php
$query="select * from table order by date {$_REQUEST['qryorder']}";
.
.
.
.
.
?>
<a href='thispage.php?qryorder=asc' >Ascending order</a>
<a href='thispage.php?qryorder=desc' >Descending order</a>
.
.
.
..
urtrivedi
Nearly a Posting Virtuoso
1,306 posts since Dec 2008
Reputation Points: 257
Solved Threads: 270
I dont know what you are asking for but I guess that you want to set selection box to the value selected by user. you may achive it using following code
<option value ="date.php?dateorder=asc"
<?php echo ($_REQUEST['dateorder']=='asc')?"selected":"";?> >ASC</option>
<option value ="date.php?dateorder=desc"
<?php echo ($_REQUEST['dateorder']=='desc')?"selected":"";?> >DESC</option>
urtrivedi
Nearly a Posting Virtuoso
1,306 posts since Dec 2008
Reputation Points: 257
Solved Threads: 270
You need to learn about "limit" clause of mysql
in user form
.
.
.
<input type=hidden name=page value=<?php echo $_REQUEST['page'];?> >
</form>
in query
$recperpage=10;
if ($_REQEUST['page']=="")
$_REQEUST['page']=0;
$startfrom=$_REQEUST['page']*$recperpage;
$query=" SELECT * FROM kiniseis
order by date {$_REQUEST['dateorder']}
limit {$startfrom},{$recperpage} ";
urtrivedi
Nearly a Posting Virtuoso
1,306 posts since Dec 2008
Reputation Points: 257
Solved Threads: 270