Jump to content

Recommended Posts

I am trying to pass the url of a page actually on to the page and I was using this:

 

<?php echo print $PATH_INFO = str_replace("/", "-",  $_SERVER['REQUEST_URI']);?>

 

but I want to include this on an include file - so lets say that that code is on a page here: "/includes/page1.php"

 

and then on page2.php I have this:

 

<?php include('/page1.php'); ?>

 

what happens is the URL on my page is written on the page as like "-page1.php" but what I want is it to say "-page2.php"

 

anyone know how to do this?

Link to comment
https://forums.phpfreaks.com/topic/64135-putting-url-to-site-on-my-page/
Share on other sites

Actually u have that code in page1.php and that page is being included in page2.php, right? I tried it myself just to be sure and it is echoing -page2.php and thats normal. Page1 is being included and that code is being parsed as code of page2, so it will return the url of page2.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.