I have a window with two buttons (one type=submit and the others type=button).When i open this window i do a query(that is a result set) to obtain some data. What i want to do is that when i press one of the buttons the window shows information of the previous record and when i press the other button the window shows the next record.
Please help me.
Here is the code.
<?php
function before(){
}
function after(){
}
echo "<html>";
echo "<head>";
echo "<meta http-equiv='Content-Language' content='es-pe'>";
echo "<meta name='GENERATOR' content='Microsoft FrontPage 5.0'>";
echo "<meta name='ProgId' content='FrontPage.Editor.Document'>";
echo "<meta http-equiv='Content-Type' content='text/html; charset=windows-1252'>";
echo "<title>CASOS</title>";
echo "</head>";
echo "<body background='/imagenes/fondoN.bmp' bgproperties='fixed'>";
echo "<p><b><font size='6'><img border='0' src='/imagenes/caso.gif' width='108' height='63'> ";
echo "<font color='#00FF00'> </font></font></b><font color='#99CCFF'><b><font size='7'> Comentarios ";
echo "<p> ";
echo " <FORM METHOD='POST' ACTION='cambiarCom.php?var=1&tipo=$tipo&comen=$comen&b=$b'> ";
$connectlog = mysql_connect(localhost,root,mysql) or die("No se puede conectar!");
$query="select comentario,fecha,hora from comentarios where rma='$b' order by fecha asc";
mysql_select_db(logistica);
$result = mysql_query($query) or die ("Error en el query: $query. " . mysql_error());
$numfilas=mysql_num_rows($result);
$row=mysql_fetch_row($result);
echo" <p align='left' size='10'><font color='#99CCFF' size='5'>Fecha: <input type='text' name='fech' value='$row[1]'size='12'> </font>";
echo" <font color='#99CCFF' size='5'> Hora: <input type='text' name='hor' value='$row[2]' size='12'> </font></p>";
echo " <p align='center'><textarea rows='12' name='comen' cols='75'>$row[0]</textarea></p>";
echo" <p align='center'> <a href='after()'><input type='button' value='Next' name='B2'> ";
echo" <a href='before()'><input type='button' value='Previous' name='B3'> ";
echo " <p align=center> <INPUT TYPE='SUBMIT' NAME='scomen'><br> ";
echo " </FORM> ";
echo "</body>";
echo "</html>";