/    Sign up×
Community /Pin to ProfileBookmark

How to set a vaiable for path

Hi,
Myself sanjay sirohee, I want to know how to set a variable for path any file in the project,

I am doing as

<?php
session_start();
$path1=$_SERVER[‘HTTP_HOST’].$_SERVER[‘PHP_SELF’];
echo $path1;
?>
Now i want to use it as
<?php
echo $_SESSION[‘$path’];
?>

please help me how to do it on correct way

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@MindzaiJul 31.2009 — Just store it in the session:

[code=php]<?php
session_start();
$_SESSION['path'] = $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
echo $_SESSION['path'];
?>[/code]
Copy linkTweet thisAlerts:
@Sanjay_SiroheeauthorAug 01.2009 — <?php

session_start();

$_SESSION['path'] = $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];

echo $_
SESSION['path'];

?>

now i have got session variable path

how can i include leftmenu.php

I'm able to do by---

<?php include"includesleftmenu.php"; ?>


I want to use $_SESSION['path'];

I don't want to give path every time I want use this variable for any path
Copy linkTweet thisAlerts:
@Sanjay_SiroheeauthorAug 01.2009 — <?php

session_start();

$_SESSION['path'] = $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];

echo $_
SESSION['path'];

?>

now i have got session variable path

how can i include leftmenu.php

I'm able to do by---

<?php include"includesleftmenu.php"; ?>


I want to use $_SESSION['path'];

I don't want to give path every time I want use this variable for any path please help me with code

thanks for any help???
×

Success!

Help @Sanjay_Sirohee spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...