Forum Moderators: coopster
<a href="http://www.mywebsite.com/some-sub-dir-name/a-php-form.php" target="_blank">Click to pop up a form to play with.</a>
I’d really like to be able to ‘pass in’ (I guess that’s the term/phrase to use) a variable (say ‘subdir’) which would be the name of the subdirectory the user was in when clicking that link.
So, if someone were viewing [mywebsite.com...]
And they clicked on the link, it would be as if the link was really like this ...
<a href="http://www.mywebsite.com/some-sub-dir-name/a-php-form.php?subdir=one-of-my-sub-dirs" target="_blank">Click to pop up a form to play with.</a>
Is there a way to do this (I want to avoid having to create custom links in every single index.html file) ?
Thanks,
Newbie in Newbiechester
[yourwebsite.com...] ?
If that's the case you could do something like this bu tyou will need to change the index.html to php.
<?
//get the document path relative to the web root directory
$docpath = $_SERVER['PHP_SELF'];
//split the document root by each "/"
//and store each name as variables within an array
$docpath = explode("/",$docpath);
//this is assuming the directory name you want is the
//first subdirectory within your web directory.
//change $docpath[0]; to $docpath[1]; if you want the next directory down
$directory_name = $docpath[0];
?>