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 8287039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:55:47+00:00 2026-06-08T11:55:47+00:00

i have a page with 4 links namely 1st.php, 2nd.php, 3rd.php, and 4th.php. my

  • 0

i have a page with 4 links namely 1st.php, 2nd.php, 3rd.php, and 4th.php. my index.php displays the 3rd.php as default. i also created a 404.php (error page) so that when a user edits the URL it will not redirect to the index.php, instead it will display the error page. the problem is when i open my index.php page, it displays the error page instead. need help. this is my code:

 <?php 

  $quarters = array('Q1', 'Q2', 'Q3', 'Q4');
        $quarter = 'Q3';

        if(isset($_GET['quarter']) && in_array($_GET['quarter'], $quarters)) {
          $quarter = $_GET['quarter'];  
        }

        switch($quarter) {
          case 'Q1' :
            $quarter = 'firstq2012.php';
          break;
          case 'Q2' :
            $quarter = 'secondq2012.php';
          break;
          case 'Q3' :
            $quarter = 'thirdq2012.php';
          break;
          case 'Q4' :
            $quarter = 'fourthq2012.php';
          break;
        }

    $pages = array('Q1','Q2','Q3','Q4');
    if (in_array($_GET['quarter'], $pages)){            
                    include_once $quarter;  
 }
 else {
 header('Location: 404.php');
  }
?>
  • 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-08T11:55:48+00:00Added an answer on June 8, 2026 at 11:55 am

    Your code can be cleaned up a lot.

    Try using this intead:

    <?php 
    $quarters = array('Q1' => 'firstq2012.php', 'Q2' => 'secondq2012.php', 'Q3' => 'thirdq2012.php', 'Q4' => 'fourthq2012.php');
    if(isset($_GET['quarter'])) {
        if(in_array($_GET['quarter'], array_keys($quarters))) {
            include_once $quarters[$_GET['quarter']];
        } else {
            header('Location: 404.php');
        }
    } else {
        include_once $quarters['Q3'];
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an index page that links to a page called categories.php In categories.php,
We have a Web application (ASP.NET) which displays in some page links to miscellaneous
I have an index page with three links as follws. When I click the
I have a vertical scrolling website (lots of in-page links). I also have a
I have a page full of links that each AJAX in an article based
I have a web page that links to another web application, which unfortunately only
I have a page with 3 columns of links at the bottom. Each column
I have a HTML page containing follwing links <a class=out href=www.a.com/hgfgtsdfdffsdfsdf>sdfsssdfddf</a> <a href=www.a.com/hgfgt>dsfdsf</a> <a
I have a page with a few links that are all like this: <a
I have a Spring 3.0.x web project that is displaying a page of links

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.