hi i have page called index.php there r 2 dropdown menus on it from database & work good i let user to choose from the 2 menus then click submit & go to the next page where it make search & display from database every 5 records per page it works first time on the first page then when I click next it dosen't work
why ?????
here's the code
where
$ sel //is the variable from the first dropdown menu
$ sel2 is the scond menu variable
i think the $ sel and $sel2 there values gone when click (next)
plz help me on this soon
<?php
$host="localhost"; //hostname
$user="fayoumon_onuser"; //user
$password="159789";//password
$db="fayoumon_website"; //database name
//$tbl="govoff"; //table name
$rown="5"; //number of rows to be display each page
//The functions
function first($start,$trows,$rown)
{
if ($start == $trows-intval($trows%$rown)&&$trows>$rown ||$start<>intval(0))
{
$first="<a href=$SCRIPT_NAME?start=0>first</a>";}
else
{
$first="first";
}
return $first;
}
function previous($start,$trows,$rown)
{
if ($start >= $trows-intval($trows%$rown)&&$trows>$rown||$start<>intval(0))
{
$prev=$start-$rown;
$previous="<a href=$SCRIPT_NAME?start=$prev>previous</a>";
}
else
{
$previous="previous";
}
return $previous;
}
function next1($start,$trows,$rown)
{
if ($start < ($trows-intval($trows%$rown))&&(($start+$rown)-$trows<>"0"))
{
$next=$start+$rown;
$next="<a href=$SCRIPT_NAME?start=$next>next</a>";
}
else
{
$next="next";
}
return $next;
}
function last($start,$trows,$rown)
{
if ($start < $trows-intval($trows%$rown)&&(($start+$rown)-$trows<>"0"))
{
if (($rem=$trows%$rown)==0){$rem=$rown;}
$last=intval($trows-$rem);
$last="<a href=$SCRIPT_NAME?start=$last>last</a>";
}
else
{
$last="last";
}
return $last;
}
//end of the functions
mysql_connect($host,$user,$password);
mysql_select_db($db);
$query="SELECT * From lawern where branch ='$sel' and gov='$sel2' order by branch";
$result=mysql_query($query);
$numrows=mysql_num_rows($result);//total number of rows equal to $trows;
if ($start=="")
{$start=0;}
$query="$query limit $start,$rown"; //limit output $rown=5 rows starting $start
$result=mysql_query($query);
print"<table border=1 width=100% >
<tr valign=top bgcolor=#FF0000>
<td colspan=4 nowrap bgcolor=#1F4D8B><div align=center><strong><font color='white'>$sel</font></strong></div></td>
</tr>
<tr>
<td bgcolor=#99CCFF ><div align=center>phone</div></td>
<td bgcolor=#99CCFF ><div align=center>address</div></td>
<td bgcolor=#99CCFF ><div align=center>name</div></td>
</tr>";
while ($row=mysql_fetch_array($result))
{
print"<tr>
<td><div align=right>$row[3]</div></td>
<td><div align=right>$row[4]</div></td>
<td><div align=right>$row[1]</div></td>
</tr>";
}
print"</table>";
print"<table bgcolor='#1F4D8B' width='100%'><tr>
<td>".first($start,$numrows,$rown)."</td>
<td>".previous($start,$numrows,$rown)."</td>
<td>".next1($start,$numrows,$rown)."</td>
<td>".last($start,$numrows,$rown)."</td>
</tr>
<tr>
<td colspan='4'>
<a href='http://www.mywebsite.com/sublinks2/lawers'><font color='ffffff'>back to the first page</font></a>
</td>
</tr>
</table>";
?>
?>