hi everyone,
i have 2 problems which makes me to stuck inbetween my application..

my first issue is:
i already used get method to pass variable values between pages which is working fine till now as follows:

$frmDate=trim($_GET);
$toDate=trim($_GET);
$time=trim($_GET);
$incoming=$_GET;
echo "<a href=\"outgoing.php?optSingle=".$c."&beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&flr=".$flr."&page=1\" ></a>";

but how can i use post method and pass values between pages...

My second issue:
i have used pagination in php.. am displaying 10 records per page and printind result as "1 - 10 records of 106 records".. but problem arises at last page where instead of "101 - 106 of 106 records" it showing as " 101 - 110 of 106 records"...

here is my code:

$query="SELECT * FROM calldetail WHERE (";
                for($i=0;$i<count($r);$i++)
                {
                    if ($r[$i][1]==null)
                    {
                        if ($i>0)
                            $query.=" OR";
                        $query.=" (CallTermination ='".$r[$i][0]."')";
                    }
                    else
                    {
                        if ($i>0)
                            $query.=" OR";
                        $query.=" (CallTermination BETWEEN '".$r[$i][0]."' AND '".$r[$i][1]."')";
                    }
                }  // end of for loop
                $query.=") and CallFlag='L' AND CallDate BETWEEN '".$frmDate1."' AND '". $toDate1."' ORDER BY ";
                if ($dat=='CallDate desc' or $dat=='CallDate asc')
                    $query.=$dat;
                $query.=" LIMIT $offset, $rowsPerPage";
                $c1='&optDat';
tab($query,$connection,$frmDate,$toDate,$incoming,$dat,$c1,$offset,$rowsPerPage,$pageNum,$row['CallFlag'],$dial,$receive);
                $query="SELECT count(CallDate) as numrows FROM calldetail WHERE (";
                for($i=0;$i<count($r);$i++) {
                    if ($r[$i][1]==null)
                    {
                        if ($i>0)
                            $query.=" OR";
                        $query.=" (CallTermination ='".$r[$i][0]."')";
                    }
                    else
                    {
                        if ($i>0)
                            $query.=" OR";
                        $query.=" (CallTermination BETWEEN '".$r[$i][0]."' AND '".$r[$i][1]."')";
                    }
                }    //end of for loop
                $query.=")and CallFlag='L' AND CallDate BETWEEN '".$frmDate1."' AND '". $toDate1."' ORDER BY CallTermination ASC";

                // how many rows we have in database

                $result  = mysql_query($query) or die('database query error, query failed');
                $row     = mysql_fetch_array($result, MYSQL_ASSOC);
                
                $numrows = $row['numrows'];
            }
                // how many pages we have when using paging?
                $maxPage = ceil($numrows/$rowsPerPage);
                // print the link to access each page
                $self = $_SERVER['PHP_SELF'];
                $nav = '';
                for($page = 1; $page <= $maxPage; $page++)
                {
                    if ($page == $pageNum)
                    {
                        $nav .= " $page ";   // no need to create a link to current page
                    }
                    else
                    {
                        $nav .= " <a href=\"$self?beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&page=$page\">$page</a> ";
                    }
                }// end of for loop

                // creating previous and next link plus the link to go straight to the first and last page
                if ($pageNum > 1) {
                    //this is activated from page 2
                    $page = $pageNum - 1;
                    $prev = " <a href=\"$self?beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&page=$page\"><img style='border-style:none' src='img/previous.gif'></a> ";
                    $first = " <a href=\"$self?beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&page=1\"><img style='border-style:none' src='img/firstenable.gif'></a> ";
                 
                }
                else {
                    //this is for first page
                    $prev  = '<img style="border-style:none" src="img/previous.gif">'; //1st page; we're on page one, don't print previous link
                    $first = '<img style="border-style:none" src="img/firstdisable.gif">'; // nor the first page link
                }
                if ($pageNum < $maxPage) {
                    $page = $pageNum + 1;
                    $next = " <a href=\"$self?beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&page=$page\"><img style='border-style:none' src='img/next.gif'></a> ";
                    $last = " <a href=\"$self?beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&page=$maxPage\"><img style='border-style:none' src='img/lastenable.gif'></a> ";
                }
                else {
                    $next = '<img style="border-style:none" src="img/next.gif">'; // we're on the last page, don't print next link
                    $last = '<img style="border-style:none" src="img/lastdisable.gif">'; // nor the last page link
                }
                // print the navigation link
                echo '<br/><center>';
                
                // and close the database connection
                if($numrows==0)
                {
                    echo "</br></br>No Records";
                }
                else
                {
                    echo $first . $prev . $next . $last;
                    echo "<p >" .'Showing <font color="red">'. ($offset+1) . " - " .  ($offset+$rowsPerPage) . "</font> &nbsp;&nbsp;of &nbsp;&nbsp;". $numrows . " Records" ."</p>";
                }

can anyone give some idea on how to do it?

As for your first issue.
You can't simply link to a page, and send post headers headers that way.

You have to send them. Usually you would use a form to send post variables.
You can also use javascript.

There is probably some way to define the headers to be sent some way in PHP, but through many years I have never even considered this useful.


As for your second question.
You could make a SIMPLE fix, by replacing

($offset+$rowsPerPage)

with

min($offset+$rowsPerPage, $numrows)

That is reliable enough. Try it.

thanks Excizted...
my second issue solved.. but am using form in my index page where am using method='post'

index.php

<form name=callsubm method="post" onsubmit="return DoSubmit()" action="outgoing.php">
                <table border="0" >&nbsp;

                    <!--From Date-->
                    <tr>
                        <td align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            From Date</td>
                        <td align="center" >
                            <input style="border-style: none;" type="text" name="beg" id="beg" size="15" ></td>
                        <td><img src="calender" alt="C" id='img1'>
                            <script language=javascript type="text/javascript">
                                var cal = new Zapatec.Calendar.setup({
                                    inputField:"beg",
                                    ifFormat:"%d-%m-%Y ",
                                    button:"img1",
                                    showsTime:false
                                });
                            </script>
                        </td>
                    </tr>

                    <!--End Date-->
                    <tr>
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            End Date</td>
                        <td align="center" >
                            <input style="border-style: none;" type="text" name="datEnd" id="datEnd" size="15" ></td>
                        <td><img src="calender" alt="C" id='img2'>
                            <script language=javascript type="text/javascript">
                                var cal = new Zapatec.Calendar.setup({
                                    inputField:"datEnd",
                                    ifFormat:"%d-%m-%Y ",
                                    button:"img2",
                                    showsTime:false
                                });
                            </script>
                        </td>
                    </tr>

                    <!--Time-->
                    <tr>
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            Time</td>
                        <td align="center" >
                            <input  style="border-style: none;" name=time id=time type="text" size="15"></td>
                        <td><input type="image" id=time name=time src="Time.png"></td>
                    </tr>

                    <!--Extension -->
                    <tr>
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            Extension</td>
                        <td align="center">
                            <input  style="border-style: none;" name=inTxt id=inTxt type="text" size="15"></td>
                        <td><input type="image" id=callBtn name=callBtn src="phone.png" >
                        </td>
                    </tr>

                    <!--Single-->
                    <tr align="center">

                        <td><p>&nbsp; </p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Single&nbsp;
                        <input class="submit" type=radio  id=optSingle name=optSingle onclick=selectpage(name)>
                        </td>

                    <!--Datewise-->
                        <td><p>&nbsp; </p>&nbsp;&nbsp;&nbsp;&nbsp;Datewise&nbsp;
                        <input class="submit" type=radio checked id=optDat name=optDat onclick=selectpage(name)>
                        </td>
                        <td></td>
                    </tr>
                </table>

                <input TYPE=HIDDEN NAME="pageNum" value="1">
                <input TYPE=HIDDEN NAME="rowsPerPage" value="10">
            </form>

and am saving that using 'post' method into a variable in another file 'outgoing.php' as follows:

outgoing.php

<?php
        $frmDate=trim($_POST['beg']);
        $toDate=trim($_POST['datEnd']);
        $time=trim($_POST['time']);
        $incoming=$_POST['inTxt'];
        $c=$_POST['optSingle'];
        $c1=$_POST['optDat'];
        $pageNum=$_POST['pageNum'];
        $rowsPerPage=$_POST['rowsPerPage'];
        $dat=$_POST['dat'];
        $self = $_SERVER['PHP_SELF'];
        // how many rows to show per page
       
        $rowsPerPage = '10';
        // by default we show first page
        // if $_GET['page'] defined, use it as page number
        if(isset($_GET['page'])) {
            $pageNum = $_GET['page'];
        }
        // counting the offset
        $offset = ($pageNum - 1) * $rowsPerPage;
        // SORTING
        if ($dat=='CallDate desc') {
            $dat='CallDate asc' ;
        }
        else {
            $dat='CallDate desc';
        }
        include 'dbconnect.php';
        <?php
            }
        }
        function db($f,$r,$t,$tlkto,$pno,$df,$tr,$tt,$nz,$ac,$dur) {
    echo '<font>';
            echo '<td >';
            chngcolor($dur);
            list($month,$day,$year)=split('[/.-]',$r);
            $dat= "$year-$day-$month";

            //starting from Date to Charges
            //$dat = Date;
            echo $dat;
            echo '</font></td>';
            echo '<td>';
            chngcolor($dur);

            //$t=Time
            echo $t;
            echo' <font></td>';
            echo '<td>';
            chngcolor($dur);

            //$dur=Call Duration
            echo  $dur;
            echo' <font></td>';
            if ($f=='L') {
                echo '<td>';
                chngcolor($dur);
                // $tlkto-Extension & $df=Origin
                echo  $tlkto."/".$df;
                echo'<font> </td>';
                echo '<td>';
                chngcolor($dur);
                ?>
                <img alt="ID" src="img/out.png" onMouseover="ddrivetip('<?php echo $pno; echo'<br>' . $ac; ?>', '#EFEFEF');" onMouseout="hideddrivetip()">
                <?php
                //$pno = Called to
                echo $pno;
                echo'<font> </td>';
            }
            else {
                echo '<td>';
                chngcolor($dur);
                     ?>
                <img alt="ID" src="id.gif" onMouseover="ddrivetip('<?php echo $pno;?>', '#EFEFEF');" onMouseout="hideddrivetip()">
                     <?php
                     //$pno = Called to
                     echo $pno;
                     echo '<font> </td>';
                     echo '<td>';
                     chngcolor($dur);
                     // $tlkto-Extension & $df=Origin
                     echo $tlkto."/".$df;
                     echo '<font> </td>';
                 }
                 echo '<td>';
                 chngcolor($dur);
                // $tr= Line
                 echo $tr;
                 echo '<font> </td>';
                 echo '<td>';
                 chngcolor($dur);
               // $tt= Pulses
                 echo $tt;
                 echo '<font> </td>';
                 echo '<td>';
                 chngcolor($dur);
                 // $nz=cost
                 echo  $nz;
                 echo '<font> </td>';
                 echo '</tr>';
             }

             function de($dat) {
                 if($dat=='CallDate asc') {
                     echo "return" ;
                 }
             }
             $fl='L';
             $flr='C';
             $missed='M';
             // DYNAMIC QUERY FUNCTION
             function tab($query,$connection,$frmDate,$toDate,$incoming,$dat,$c,$offset,$rowsPerPage,$pageNum,$tme,$dial,$receive)
             {
                 //  echo $query;
                 //   echo '</br>'.$connection.'</br>';
                 $result = mysql_query($query, $connection) or die('Dynamic query function: error making query</br>' . mysql_error());
                 //  echo "hi";
                 $affected_rows = mysql_num_rows($result);
                 //  echo $affected_rows.'</br>';
                 ?>

        <center>
            <table width="100%">
                <thead>
                    <tr>
                        <th>Date</th>
                        <th>Time</th>
                        <th>Call Duration</th>
                        <th>Ext./ Origin</th>
                        <th>Called To</th>
                        <th>Line</th>
                        <th>Pulses</th>
                        <th>Charges</th>
                    </tr>
                </thead>
    <?php

                    while($row = mysql_fetch_array($result)) {
                    //    if($row['CallFlag']=='L')//outgoing
                      //  {
                            if($c%2==0) {

                                ?>
                <tbody>
                    <tr  onMouseOver="this.className='highlight'" onMouseOut="this.className='change'" >
                                <?php
                                db($row['CallFlag'],$row['CallDate'],$row['CallStartTime'],$row['CallTermination'],$row['CalledNumber'],$row['CallOrigin'],$row['CallTrunk'],$row['CallPulse'],$row['Cost'],$row['CountryCode'],$row ['CallDuration']);
                            }
                            else {
                                ?>
                    </tr>
                    <tr  onMouseOver="this.className='highlight'" onMouseOut="this.className='no'" >
                                <?php
                                db($row['CallFlag'],$row['CallDate'],$row['CallStartTime'],$row['CallTermination'],$row['CalledNumber'],$row['CallOrigin'],$row['CallTrunk'],$row['CallPulse'],$row['Cost'],$row['CountryCode'],$row ['CallDuration']);
                                ?>
                    </tr>
                </tbody>
                                <?php
            }
                                    $c=$c+1;
                          //      }  // end of
                            } // end of while
                            ?>
            </table>

    <?php

                        }

// change the date format to mysql format
                list($month,$day,$year)=split('[/.-]',$frmDate);
                $frmDate1= "$year-$day-$month";
                //$frmDate1= "$year-$month-$day";
                list($month,$day,$year)=split('[/.-]',$toDate);
                // intialize  the values
                $toDate1= "$year-$day-$month";
                //$toDate1= "$year-$month-$day";
                $connection = mysql_connect($host, $db_user, $db_pass) or die("Connection Error:"+mysql_error());
                mysql_select_db($dbname, $connection) or die("hi".mysql_error());
                $string=$incoming;
                $tok = strtok($string, ",");
                $totalstr=strlen($string);
                $i=0;
                while($tok !== false)
                {
                    $s[$i]=$tok;
                    //echo $s[$i];
                    $tok = strtok(",");
                    // echo $tok;
                    $i=$i+1;
                }
                for($i=0;$i<count($s);$i++)
                {
                    for($j=0;$j<2;$j++)
                    {
                        $len= strlen($s[$i]);
                        if (($len<5)&($j==0))
                        {
                            $r[$i][$j]=$s[$i];
                            $r[$i][$j];
                        }
                        else
                        {
                            $r[$i][$j]=null;
                            $r[$i][$j];
                        }
                        if (($len>5)&($j==0))
                        {
                            //echo $s[$i];
                            $str=strpos($s[$i],'-') ;
                            $fs=substr($s[$i],0,$str);
                            $r[$i][$j]=$fs;
                            $r[$i][$j];
                        }
                        elseif (($len>5)&($j==1))
                        {
                            $ls=substr($s[$i],$str+1,strlen($s[$i]));
                            $r[$i][$j]=$ls;
                            $r[$i][$j];
                        }
                    }
                }
            echo '<input type="hidden" id="h1" name="h1" value="'.$incoming.'">';
            echo '<input type="hidden" id="h2" name="h2" value="'.$frmDate1.'">';
            echo '<input type="hidden" id="h3" name="h3" value="'.$toDate1.'">';

            echo "<a href=\"outgoing.php?optSingle=".$c."&beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&flr=".$flr."&page=1\" ><img style='border-style:none' src='img/e-dialed.gif'></a>";
            echo "<a href=\"incoming.php?optSingle=".$c."&beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&flr=".$flr."&page=1\"><img style='border-style:none' src='img/received.gif'></a>";
            echo "<a href=\"missed.php?optSingle=".$c."&beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&flr=".$missed."&page=1\"><img style='border-style:none' src='img/missedcalls.gif'></a>";
            echo "<a href=\"consolidated.php?optSingle=".$c."&beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&flr=".$missed."&page=1\"><img style='border-style:none' src='img/consolidated.gif'></a>";

            //if of single radio button is selected
            if ($c=='on')
            {
                //DYNAMIC QYERY
//                if(!empty($incoming))
//                {
                    if(!empty($time))
                    {
                        $query="SELECT * FROM calldetail WHERE (";
                        for($i=0;$i<count($r);$i++)
                        {
                            if ($r[$i][1]==null)
                            {
                                if ($i>0)
                                    $query.=" OR";
                                $query.=" (CallTermination ='".$r[$i][0]."')";
                            }
                            else
                            {
                                if ($i>0)
                                    $query.=" OR";
                                $query.=" (CallTermination BETWEEN '".$r[$i][0]."' AND '".$r[$i][1]."')";
                            }
                        }  //end of for loop
                        $query.=") AND CallFlag='L' AND CallDate BETWEEN '".$frmDate1."' AND '". $toDate1."' and substr(CallDuration,4,2)='".$time. "' ORDER BY $dat";
                        //echo $query;
                        //$query.=" LIMIT $offset, $rowsPerPage";
                        tab($query,$connection,$frmDate,$toDate,$incoming,$dat,$c,$offset,$rowsPerPage,$pageNum,$row['CallFlag'],$dial,$receive);
                        $result = mysql_query($query, $connection) or die('c=on:error making query');
                        $affected_rows = mysql_num_rows($result);
                        //echo $affected_rows;
                        $row=mysql_fetch_array($result);
                        //echo $row;
                        echo "<p >" .'Total Records: <font color="red">'. $affected_rows ."</font></p>";
                    }
                    else
                    {
                        $query="SELECT * FROM calldetail WHERE (";
                        for($i=0;$i<count($r);$i++)
                        {
                            if ($r[$i][1]==null)
                            {
                                if ($i>0)
                                    $query.=" OR";
                                $query.=" (CallTermination ='".$r[$i][0]."')";
                            }
                            else
                            {
                                if ($i>0)
                                    $query.=" OR";
                                $query.=" (CallTermination BETWEEN '".$r[$i][0]."' AND '".$r[$i][1]."')";
                            }
                        }  //end of for loop
                        $query.=") AND CallFlag='L' AND CallDate BETWEEN '".$frmDate1."' AND '". $toDate1."' ORDER BY $dat";
                        //echo $query;
                        //$query.=" LIMIT $offset, $rowsPerPage";
                        tab($query,$connection,$frmDate,$toDate,$incoming,$dat,$c,$offset,$rowsPerPage,$pageNum,$row['CallFlag'],$dial,$receive);
                        $result = mysql_query($query, $connection) or die('c=on:error making query');
                        $affected_rows = mysql_num_rows($result);
                        //echo $affected_rows;
                        $row=mysql_fetch_array($result);
                        //echo $row;
                        echo "<p >" .'Total Records: <font color="red">'. $affected_rows ."</font></p>";
                    }
            }

            // if of datewise radio button is selected
            else
            {
                //database query
                if(!empty($time))
                {
                    $query="SELECT * FROM calldetail WHERE (";
                for($i=0;$i<count($r);$i++)
                {
                    if ($r[$i][1]==null)
                    {
                        if ($i>0)
                            $query.=" OR";
                        $query.=" (CallTermination ='".$r[$i][0]."')";
                    }
                    else
                    {
                        if ($i>0)
                            $query.=" OR";
                        $query.=" (CallTermination BETWEEN '".$r[$i][0]."' AND '".$r[$i][1]."')";
                    }
                }  // end of for loop
                $query.=") and CallFlag='L' AND CallDate BETWEEN '".$frmDate1."' AND '". $toDate1."' and substr(CallDuration,4,2)='".$time. "' ORDER BY ";
                if ($dat=='CallDate desc' or $dat=='CallDate asc')
                    $query.=$dat;
                $query.=" LIMIT $offset, $rowsPerPage";
                $c1='&optDat';
                //echo $query;
                //echo "<br/> HI welcome \n ".$query;
                tab($query,$connection,$frmDate,$toDate,$incoming,$dat,$c1,$offset,$rowsPerPage,$pageNum,$row['CallFlag'],$dial,$receive);
                $query="SELECT count(CallDate) as numrows FROM calldetail WHERE (";
                for($i=0;$i<count($r);$i++) {
                    if ($r[$i][1]==null)
                    {
                        if ($i>0)
                            $query.=" OR";
                        $query.=" (CallTermination ='".$r[$i][0]."')";
                    }
                    else
                    {
                        if ($i>0)
                            $query.=" OR";
                        $query.=" (CallTermination BETWEEN ".$r[$i][0]." AND ".$r[$i][1].")";
                    }
                }    //end of for loop
                $query.=")and CallFlag='L' AND CallDate BETWEEN '".$frmDate1."' AND '". $toDate1."' ORDER BY CallTermination ASC";
                //echo $query."<br/>";
                // how many rows we have in database
                //echo $query;
                $result  = mysql_query($query) or die('database query error, query failed');
                $row     = mysql_fetch_array($result, MYSQL_ASSOC);
                $numrows = $row['numrows'];
                }

           else
           {
                $query="SELECT * FROM calldetail WHERE (";
                for($i=0;$i<count($r);$i++)
                {
                    if ($r[$i][1]==null)
                    {
                        if ($i>0)
                            $query.=" OR";
                        $query.=" (CallTermination ='".$r[$i][0]."')";
                    }
                    else
                    {
                        if ($i>0)
                            $query.=" OR";
                        $query.=" (CallTermination BETWEEN '".$r[$i][0]."' AND '".$r[$i][1]."')";
                    }
                }  // end of for loop
                $query.=") and CallFlag='L' AND CallDate BETWEEN '".$frmDate1."' AND '". $toDate1."' ORDER BY ";
                if ($dat=='CallDate desc' or $dat=='CallDate asc')
                    $query.=$dat;
                $query.=" LIMIT $offset, $rowsPerPage";
                $c1='&optDat';
                //echo $query;
                //echo "<br/> HI welcome \n ".$query;
                tab($query,$connection,$frmDate,$toDate,$incoming,$dat,$c1,$offset,$rowsPerPage,$pageNum,$row['CallFlag'],$dial,$receive);
                $query="SELECT count(CallDate) as numrows FROM calldetail WHERE (";
                for($i=0;$i<count($r);$i++) {
                    if ($r[$i][1]==null)
                    {
                        if ($i>0)
                            $query.=" OR";
                        $query.=" (CallTermination ='".$r[$i][0]."')";
                    }
                    else
                    {
                        if ($i>0)
                            $query.=" OR";
                        $query.=" (CallTermination BETWEEN ".$r[$i][0]." AND ".$r[$i][1].")";
                    }
                }    //end of for loop
                $query.=")and CallFlag='L' AND CallDate BETWEEN '".$frmDate1."' AND '". $toDate1."' ORDER BY CallTermination ASC";
                //echo $query."<br/>";
                // how many rows we have in database
                //echo $query;
                $result  = mysql_query($query) or die('database query error, query failed');
                $row     = mysql_fetch_array($result, MYSQL_ASSOC);
                
                $numrows = $row['numrows'];
            }
                $maxPage = ceil($numrows/$rowsPerPage);
                // print the link to access each page
                $self = $_SERVER['PHP_SELF'];
                $nav = '';
                for($page = 1; $page <= $maxPage; $page++)
                {
                    if ($page == $pageNum)
                    {
                        $nav .= " $page ";   // no need to create a link to current page
                    }
                    else
                    {
                        $nav .= " <a href=\"$self?beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&page=$page\">$page</a> ";
                    }
                }// end of for loop
                if ($pageNum > 1) {
                    //this is activated from page 2
                    $page = $pageNum - 1;
                    $prev = " <a href=\"$self?beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&page=$page\"><img style='border-style:none' src='img/previous.gif'></a> ";
                    $first = " <a href=\"$self?beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&page=1\"><img style='border-style:none' src='img/firstenable.gif'></a> ";
                }
                else {
                    //this is for first page
                    $prev  = '<img style="border-style:none" src="img/previous.gif">'; //1st page; we're on page one, don't print previous link
                    $first = '<img style="border-style:none" src="img/firstdisable.gif">'; // nor the first page link
                }
                if ($pageNum < $maxPage) {
                    $page = $pageNum + 1;
                    $next = " <a href=\"$self?beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&page=$page\"><img style='border-style:none' src='img/next.gif'></a> ";
                    $last = " <a href=\"$self?beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&page=$maxPage\"><img style='border-style:none' src='img/lastenable.gif'></a> ";
                }
                else {
                    $next = '<img style="border-style:none" src="img/next.gif">'; // we're on the last page, don't print next link
                    $last = '<img style="border-style:none" src="img/lastdisable.gif">'; // nor the last page link
                }
                // print the navigation link
                echo '<br/><center>';
                echo $first . $prev . $next . $last;
                // and close the database connection
                if($numrows==0)
                {
                    echo "No Records";
                }
                else
                {
                    echo "<p >" .'Showing <font color="red">'. ($offset+1) . " - " .  ($rowsPerPage+$offset) . "</font> &nbsp;&nbsp;of &nbsp;&nbsp;". $numrows . " Records" ."</p>";
                }
            }

            // for calculating cost
                if(!empty($time))
                {
                    $query="SELECT SUM(Cost) as COST1 FROM calldetail WHERE (";
                    for($i=0;$i<count($r);$i++)
                    {
                        if ($r[$i][1]==null)
                        {
                            if ($i>0)
                                $query.=" OR";
                            $query.=" (CallTermination ='".$r[$i][0]."')";
                        }
                        else
                        {
                            if ($i>0)
                                $query.=" OR";
                            $query.=" (CallTermination BETWEEN ".$r[$i][0]." AND ".$r[$i][1].")";
                        }
                    }
                    $query.=") and CallFlag='L' AND CallDate BETWEEN '".$frmDate1."' AND '". $toDate1."' and substr(CallDuration,4,2)='".$time."' ORDER BY CallTermination ASC";
                    //echo $query;
                    $result = mysql_query($query, $connection) or die('incoming is not empty:error making query');
                    // echo 'connection successful';
                    // echo $result;
                    $affected_rows = mysql_num_rows($result);
                    $row=mysql_fetch_array($result);
                    // echo $row['COST1'];
                    echo '<center>';
                    //echo $query;
                    $calledcost=$row['COST1'];
                    echo ''."Total Cost = <font color='red'>Rs " .$calledcost .'</font>';
                }
                else
                {
                    $query="SELECT SUM(Cost) as COST1 FROM calldetail WHERE (";
                    for($i=0;$i<count($r);$i++)
                    {
                        if ($r[$i][1]==null)
                        {
                            if ($i>0)
                                $query.=" OR"; 
                            $query.=" (CallTermination ='".$r[$i][0]."')";
                        }
                        else
                        {
                            if ($i>0)
                                $query.=" OR";
                            $query.=" (CallTermination BETWEEN ".$r[$i][0]." AND ".$r[$i][1].")";
                        }
                    }
                    $query.=") and CallFlag='L' AND CallDate BETWEEN '".$frmDate1."' AND '". $toDate1."' ORDER BY CallTermination ASC";
                    //echo $query;
                    $result = mysql_query($query, $connection);// or die('incoming is not empty:error making query');
                    // echo 'connection successful';
                    // echo $result;
                    $affected_rows = mysql_num_rows($result);
                    $row=mysql_fetch_array($result);
                    // echo $row['COST1'];
                    echo '<center>';
                    //echo $query;
                    $calledcost=$row['COST1'];
                    
                     echo "Records". $_POST['rowsPerPage'];echo "</br>";
                    echo ''."Total Cost = <font color='red'>Rs " .$calledcost .'</font>';
                }
            // To give the Printer option
            echo "<br><a href=\"print_page.php?fromdate=".$frmDate."&todate=".$toDate."&exten=".$incoming."&time=".$time."\"><img style='border-style:none;' src='img/Print-icon.png'></a>";
//echo "<a href=\"outgoing.php?optSingle=".$c."&beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&fl=".$fl."&page=1\" ></a>";
            ?>

I am no longer sure what you mean :)

I assume:

You have a form, and post the information to another page.
Then you want to send the information from that other page, ahead again.

Take a look at this:

Page1.html

<form action="Page2.php" method="post">
<input type="text" name="firstname" />
<input type="submit" value="Go!" />
</form>

Page2.php

<?php
$firstname = $_POST["firstname"];
mysql_query("INSERT INTO mytable SET firstname = '".$firstname."'") or die(mysql_error());

echo "<form action=\"Page3.php\" method=\"post\">
<input type=\"hidden\" name=\"firstname\" value=\"", $firstname, "\" />
<input type=\"submit\" value=\"Continue\" />
</form>";

?>

Page3.php

<?php
$firstname = $_POST["firstname"];
echo "Your name has been stored, ", $firstname, "!";
?>

I hope this helps you :)

thanks Excizted, my problem is i cant understan how to pass variable values to next page using post method.. in my program am using GET method where am passing values in url such as:

echo "<a href=\"outgoing.php?optSingle=".$c."&beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&fl=".$fl."&page=1\" ><img style='border-style:none' src='img/dialed.gif'></a>";
            echo "<a href=\"incoming.php?optSingle=".$c."&beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&flr=".$flr."&page=1\"><img style='border-style:none' src='img/e-received.gif'></a>";
            echo "<a href=\"missed.php?optSingle=".$c."&beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&flr=".$missed."&page=1\"><img style='border-style:none' src='img/missedcalls.gif'></a>";
            echo "<a href=\"consolidated.php?optSingle=".$c."&beg=".$frmDate."&datEnd=".$toDate."&inTxt=".$incoming."&flr=".$missed."&page=1\"><img style='border-style:none' src='img/consolidated.gif'></a>";

but how can i done using POST... am i clear? or still confusing?

can u give some example how on post-mysql ....

@Ambism hes just throwing a bunch of codes... good luck to you boy ^_^

Member Avatar for rajarajan2017
<form method=post name="myform" action="outgoing.php">
	<input type="text" name="incoming" value="">
	<input type="text" name="f1" value="">
//Likewise create your options and date fields with the relevant name
</form>

<a href="#" onclick="document.myform.submit(); return false">your image tag</a>

in your outgoing.php

Just call the variables by

<?php
$incoming=$_POST['incoming'];
echo $incoming;
?>

Haven't read this all in too much detail so maybe I've got the wrong idea ... still, here's a thought ...

Do you want to take the $_GET values and pass them to the next page when the user clicks submit on a form?

You can leave the action blank and then the form submits to the same URL along with the variables. Then you have to manage any form actions in the same page.

Or ... can't you take the incoming $_GET fields and put them into hidden inputs in your form and then $_POST them along with the new data?

Sorry if I've missed the point but it might be useful ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.