Jump to content

what am i doing wrong here guys


the-botman

Recommended Posts

hey guys... i am trying to use pagination but it seems my code is wrong can someone please help me by checking it

function Show_Form() {
      $getMyDataFrom = form.txt;    

      $page=0;


$numsent=100; //number of sentences per page

     $lines = file($getMyDataFrom);
     $startnum=$page*$numsent;
     $endnum=$startnum+$numsent;
     $numpartsinstring=count($lines); //counts number of lines in string

for($i=0;$i<$startnum;$i++){
   unset($lines [$i]); //kills parts before
}

for($j=$endnum;$j<$numpartsinstring;$j++){
  unset($lines [$j]); // kill parts after
}

$newstring=implode($lines,'<br>');
     $i=0; 
$upper = 60;

while ($i <= $upper) {
    $newstring = $i;
    $i++;
}


     print '<font face="Verdana" size="2">' .$newstring. '</font>';
     print "<br><br>";
$numpages=ceil($numpartsinstring/$numsent);

for($i=1;$i<=$numpages;$i++){
    $actualstart=$i-1;
if($actualstart!=$page)  {
     print '<a href="index.php&page='.$actualstart.'">'.$i.'</a> ';
}else  {
     print "$i ";
  }
}

Link to comment
https://forums.phpfreaks.com/topic/201117-what-am-i-doing-wrong-here-guys/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.