this is really strange! i tried to use the code you gave to order. i also have on my script the limit to 50 records per page.
if(isset($_POST['orderby'])) {
$order = addslashes($_POST['orderby']);
$query = "SELECT * FROM tableWHERE
(CNOMEN LIKE '%$CNOMEN%'
AND NOMRL LIKE '%$NOMRL%'
AND PROVRELCD LIKE '%$PROVRELCD%'
AND NATDAT1 LIKE '%$NATDAT1%'
AND PROFTDAT1 LIKE '%$PROFTDAT1%'
AND PROFSDAT1 LIKE '%$PROFSDAT1%'
AND SACDAT1 LIKE '%$SACDAT1%'
AND CETO_NAME LIKE '%$CETO_NAME%'
AND IDNUMF LIKE '%$IDNUMF%'
AND SDATFIN1 = ' '
AND MORTDAT1 = ' ')
ORDER BY $order ASC
LIMIT $limitvalue, $limit ";
} else {
$query = " SELECT * FROM table WHERE
(CNOMEN LIKE '%$CNOMEN%'
AND NOMRL LIKE '%$NOMRL%'
AND PROVRELCD LIKE '%$PROVRELCD%'
AND NATDAT1 LIKE '%$NATDAT1%'
AND PROFTDAT1 LIKE '%$PROFTDAT1%'
AND PROFSDAT1 LIKE '%$PROFSDAT1%'
AND SACDAT1 LIKE '%$SACDAT1%'
AND CETO_NAME LIKE '%$CETO_NAME%'
AND IDNUMF LIKE '%$IDNUMF%'
AND SDATFIN1 = ' '
AND MORTDAT1 = ' ')
ORDER BY CNOMEN ASC
LIMIT $limitvalue, $limit ";
}
when i try to search with my search form it automatically outputs the recored as ORDER BY CNOMEN ASC (which is fine). below the output i have a form that one can use in order to change the order of the output, which is this:
<form method="POST" action="<?$PHP_SELF?>">
<font face="Verdana">
</font><input type="radio" name="orderby" value="NATDAT1"><font size="2">Order by Birthday<br>
</font><input type="radio" name="orderby" value="NOMRL"><font size="2">Order by
First Name</font></font></p>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
now the problem is this, when i choose for example order by birthday then submit, it will output not only the searched but the entire database!
the strange thing is this! since i have 53 records and i limit each page to 50, the output will give me a second page, 1 showing 1-50 and page 2 showing 51-53. if i click on the second page and the there the option of ordering the accdg. to bday, the script works well! it does it only for the 53! but when i try to go back to page 1 it will give me again the default order which is the surname! any idea! thanks