hi all!!
here is the code...i am working on code snippets taken from ridwank gallery and trying to experiment with it....the problem is that the code isnt working properly.....when i click on the page numbers...the desired output isnt achieved!!!
any help wud be appreciated! i am pasting here the guestbook.php and my guestbook.txt
//guestbook.php
<html>
<body>
<?php
$data="guestbook.txt";
if($file=fopen($data,"r"))
{
while(!feof($file))
{
$contents_old.=fgets($file,255);
}
fclose($file);
}
$ar_row=explode("\n",$contents_old);
$recperpage=3;
$row_first=1;
$row_last=count($ar_row)-1;
if (empty($row_start)){ $row_start=$row_first; }
$row_end=$row_start+$recperpage-1;
if ($row_end>$row_last){ $row_end=$row_last; }
if ($row_last>$recperpage){
echo "Page : ";
for ($p=1; $p<=ceil($row_last / $recperpage); $p++){
if ($p>1){ $start=((($p-1)*$recperpage)+1);
} else { $start=1; }
if ($p==ceil($row_start/$recperpage)){ $tdcol="#cccccc"; } else { $tdcol="#ffffff"; }
echo "<font style=\"background-color:$tdcol\">[<a href=\"$PHP_SELF?row_start=$start\">$p</a>]</font> ";
}
} echo "<table bgcolor=#EEEEEE border=1 cellspacing=0 cellpadding=5 style=\"border-collapse:collapse\" bordercolor=#999999>\n";
for ($r=$row_start; $r<=$row_end; $r++){
$ar_field=explode("\t",$ar_row[$r]);
$tanggal=$ar_field[0];
$name=$ar_field[1];
$description=$ar_field[2];
echo "<tr><td rowspan=3>$r <td><small>$tanggal<td><small>$name</tr>";
echo "<tr><td bgcolor=#FFFFFF colspan=2>";
echo "</tr>";
echo "<tr><td bgcolor=#FFFFFF colspan=2>$description</tr>";
}
echo "</table>";
?>
</body>
</html>
//guestbook.txt
garry garry@garry.gg gfgdgd untitled.JPG
harry isgarry@garry.ff gfgdgd untitled.JPG
larry garry11@garry.gg gfgdgd untitled.JPG
perry garry12@garry.gg gfgdgd untitled.JPG
cherry garry14@garry.gg hello pacific.jpg
merry garry15@garry.gg hello pacific.jpg
yerry garry16@garry.gg hello pacific.jpg
cheers
Garry