Doubt in include function
Posted: Mon Mar 21, 2011 7:03 am
Iam doing a project on bookmarking and i want to get the url of a page automatically when the user clicks a button.
the problem is that i have a common header layout that is applied on all pages and i want to put the bookmark button on the header so that i will get it on all pages.
but now iam getting only the url of the include page(example.php) and not getting the intended result.i need the url of the page where the header comes.anyone please help.thanks in advance.
my current function is like this.
the problem is that i have a common header layout that is applied on all pages and i want to put the bookmark button on the header so that i will get it on all pages.
but now iam getting only the url of the include page(example.php) and not getting the intended result.i need the url of the page where the header comes.anyone please help.thanks in advance.
i have problems with $_SERVER['PHP_SELF'] . I got 2 pages one is bookmark.php and other example.php.
I'm using include function to include the example.php inside bookmark.php. While accessing the $_SERVER['PHP_SELF'] i'm getting " temp/example.php" as URL in place of "temp/bookmark.php".
Can any one tell how to get the desire Url "temp/bookmark.php" when i use include function....?
my current function is like this.
Code: Select all
<div >
<form method="post" action="">
<button type="submit" name="Bookmark" value="Bookmark"><img src="images/bookmark.png" alt="" width="20" height="20" /></button>
</form>
</div>
<?php
function curPageURL() {
$pageURL = $_SERVER['PHP_SELF'];
return $pageURL;
}
if(isset($_POST["Bookmark"]))
{
function_exists(curPageURL());
$_SESSION[url]=curPageURL();
$_SESSION[pageid]="$pageid";
echo "<script>window.location='add_bookmark.php'</script>";
}
?>