I am developing calendar in php.in this i created next and previous button ,but it is not working greate.I used get variable for Next and previous.but only previous button is only working.this is my code-

                            <? if (isset($_GET['nm']))
                            {
                                if($_GET['nm']==0)
                                {
                                    $previous="pm=1";
                                    $next="nm=1";
                                    $month=0;
                                }
                             else {
                                 $nm=$_get['nm']+1;
                                 $pm=$_GET['nm']-1;
                                    $previous="nm=".$pm;
                                    $next="nm=".$nm;
                                    $month=$_get['nm'];
                                  }
                            }
                            if (isset($_GET['pm'])){
                                if($_GET['pm']==1)
                                {

                                    $previous="pm=2";
                                    $next="nm=0";
                                    $month=-1;
                                }
                                else {
                                 $nm=$_get['pm']-1;
                                 $pm=$_GET['pm']+1;
                                    $previous="pm=".$pm;
                                    $next="pm=".$nm;
                                    $month=-1*$_GET['pm'];
                                }
                            }
?>
                            <table>
                                <tr>
                                    <td><a href="calendar.php?<? echo $previous;?>"><img src="images/previous.png"></img></a></td>
                                    <td><? echo date('Y-m-d'); ?></td>
                                    <td><a href="calendar.php?<? echo $next;?>"><img src="images/next.png"></img></a></td>
                                </tr>
                            </table>

please help me to make next and previous logic.

I have solved the problem.

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.