Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8798609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:08:04+00:00 2026-06-14T00:08:04+00:00

This my code. /*******************************PHP CODE*****************************************/ if(isset($_GET[‘date’])){ // $date = $_GET[‘date’]; $date = date(‘Y’, strtotime($date));

  • 0

This my code.

/*******************************PHP CODE*****************************************/
if(isset($_GET['date'])){ //
    $date = $_GET['date']; 
    $date = date('Y', strtotime($date));
}
else{
    $tomorrow = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
    $date = date("Y", $tomorrow);
}


/*************************************************************************/
<table width="214" height="78" border"0">
    <tr align="center">
    <td colspan="10"><a href="?date=<?= date("Y", strtotime($date .'-1 year')) ?>"  title="Previous Day" >Previous Year</a></td>

    <td width="95" colspan="2"><a href="?date=<?= date("Y", strtotime($date . '+1 year')) ?>" title="Next Day" >Next Year</a></td>

    </tr>
    <tr align="center">
    <td colspan="12" align="center"></td></tr>
</table>

/***********************************************************/

It is working but if I press NEXT year it will take me to 2013 and then I press
‘PREVIOUS Year’ it take me to 2011 instead of 2012.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:08:05+00:00Added an answer on June 14, 2026 at 12:08 am

    You’re getting too crazy with these date functions when all you’re working with is year numbers.

    $tomorrow = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
    $date = date("Y", $tomorrow);
    

    This is identical to simply:

    $date = date("Y");
    

    And $tomorrow doesn’t make sense there, you’re just getting the current date in a long winded way. You also have some confusing stuff here:

    <a title="Next Day">Next Year</a>
    

    And this:

    date("Y", strtotime($date . '+1 year'))
    

    Is the same as simply $date + 1.

    Also if you use strtotime, make sure not to mash things together. strtotime($date .'-1 year') comes out as something like strtotime('2012-1 year') which will not work, put a space before the minus symbol if you must use this approach.

    I think this might be what you’re after if you’re just working with years:

    <?php
    if(isset($_GET['date'])) {
        $date = $_GET['date']; 
    } else {
        $date = date("Y"); // current year
    }
    ?>
    
    <a href="?date=<?= $date - 1 ?>">Previous Year</a></td>
    <a href="?date=<?= $date + 1 ?>">Next Year</a></td>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code <?php session_start(); if (isset($_GET[cmd])) $cmd = $_GET[cmd]; else die(You should
I use this code: <?php if(isset($_GET[hub_challenge])) { echo $_GET[hub_challenge]; } else { } $ch
I am using this PHP code: if (isset($_GET['c'])) { $pages = array(home, upload, signup);
When I execute this following code for example: cart.php?p=1&action=add <?php session_start(); if (isset($_GET['p']) &&
Here's a php code if(isset($_GET['id'])) { //do something } else { redirect('index.php'); //redirect is
So I have this code: <?php if (!isset($_GET['email']) && !isset($_GET['key'])) { echo 'NOT ALLOWED
I'm getting a syntax error on this PHP code: <snip> $last = (isset($_GET['last']) &&
This is my php code <?php if(isset($_GET['name'])) { $var = $_GET['name']; $newvar =str_replace (
Currently I have this code: <?php if (isset($_GET['id'])) { $itemid = $_GET['id']; $search =
I have this PHP code to highlight the Query on search results. if (isset($_REQUEST['k'])){

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.