Jump to content

MY FIRST TOPIC .. NEED HELP PLZ


albasel

Recommended Posts

Hello every body here

 

I have a folder contain more than 6oo htm pages and I want to call them in one php file

I have this code working fine but this time failed to show the htm files.

 

This is the php code

<?php
        if (!isset($_GET['p'])) { // If no page is chosen load this page
             include("pages/main.htm");
        }
        else{
             $filename="pages/" . $_GET['p'] . ".htm";
             if (file_exists($filename)){
                 include("pages/" . $_GET['p'] . ".htm");
             }
             else{
                 include("pages/error.htm");
             }

        }

        ?>

 

I usually link to display htm pages as follow

 

example

index.php?p=100

 

and the htm page 100 from the the directory will be called and displayed

 

I do not why this time it is not working with me

 

please i need help ASA

 

or some one do for me new php code

 

Link to comment
https://forums.phpfreaks.com/topic/118588-my-first-topic-need-help-plz/
Share on other sites

Not sure what is wrong but:

             $filename="pages/" . $_GET['p'] . ".htm";
            if (file_exists($filename)){
                include("pages/" . $_GET['p'] . ".htm");

Is pointless excess code. Should be:

             $filename="pages/" . $_GET['p'] . ".htm";
            if (file_exists($filename)){
                include($filename);

That isn't going to help you. All it will do is reduce the code size making it shorter, its the same code, just with better use of a variable.

 

How about you let me know what this does:

 

$filename="./pages/" . $_GET['p'] . ".html";
             if (file_exists($filename)){
                 include($filename);

I have try this also those not work

$filename="./pages/" . $_GET['p'] . ".html";
             if (file_exists($filename)){
                 include($filename);

 

DIR name is pages

Incloude 650 htm pages

i have index php file not in the same DIR beside the pages DIR

i want to call the htm pages in the from the pages DIR

 

plz

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.