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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:14:10+00:00 2026-06-17T21:14:10+00:00

I’m not sure if the title here is appropriate and my explanation might be

  • 0

I’m not sure if the title here is appropriate and my explanation might be just as bad but here it goes… I am using the following code to generate web pages:

source: Dynamic inclusion in PHP

<?php

$id = $_GET['id']; 

$display = $_GET['display'];
    $displays = array('page1', 'page2', 'page3', 'page4', 'page5&amp;id=$id');

if (!empty($display)) {
        if(in_array($display,$displays)) {
            $display .= '.php';
            include($display);
        }
        else {
        echo 'Page not found. Return to
        <a href="index.php">Index</a>';
        }
    }
    else { //show html

?>

a typical page:

http://www.website.com/dir/index.php?display=page4

My problem is this: I want to add a page to the array of allowed pages that has a dynamic value. You can see my attempt at this in the code above where i added: ‘page5&id=$id’

However when i go to this page:

http://www.website.com/dir/index.php?display=page5&id=2

I get the error message “Page not found. Return to Index”.
(The table row id with value of 2 does exist in the database.)

  • 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-17T21:14:12+00:00Added an answer on June 17, 2026 at 9:14 pm

    You should better handle the display and ID values separately. For example like this:

    <?php
    
    $display = $_GET['display'];
    $displays = array('page1', 'page2', 'page3', 'page4', 'page5');
    
    if (!empty($display)) {
            if(in_array($display,$displays)) {
                $display .= '.php';
                include($display);
            }
            else {
            echo 'Page not found. Return to
            <a href="index.php">Index</a>';
            }
        }
        else { //show html
    
    ?>
    

    and in display5.php:

     <?php
    
     // some other initializations
    
     $id = $_GET['id'];
     if($id == 2) { // make some special actions for id = 2
    
     // show more html
     ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using JSon response to parse title,date content and thumbnail images and place
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.