Jump to content

Recommended Posts

All..

I'd like a .htm page to contain php script that can detect the file name of the current loaded page....

eg if a user clicks a link that loads the following page ...

www.myhost.com/12345.htm

I'd like 12345.htm to contain code that is able to extract the /12345.htm for storeage in a table or echo to the screen etc....

I have been playing around with

<?php
$url1=$_SERVER['REQUEST_URI'];
echo $url1;
?>

which works fine but when I attempt to encapsulate this in html and save and then load it as a .htm file the only output I get is "This is a test file"

<html>
<body>
This is a test file
<?php
$url1=$_SERVER['REQUEST_URI'];
echo $url1;
?>
</body>
</html>

Am I missing something simple!!!??
Make sure that .htm is set as a php extension for IIS or Apache, depending on what your using. Normally .php is set as a php script, and the other extensions will be treated as ordinary html (.htm, .html). Other exetention that can be set include .cfm for coldfusion, .asp for asp, and so on and so forth.

Basically it's in the configuration of your server.
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.