Help with variables.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mleskine
Forum Newbie
Posts: 7
Joined: Fri Feb 14, 2003 6:44 am

Help with variables.

Post by mleskine »

Hi,
I have for example 2 php pages, page1.php and page2.php. On the page1.php i have a variable $path, which has a dir path in it. I need this variable in the page2.php. How can i send it? i Can't use include "page1.php" in the page2.php.

thanks, this site has helped alot during my development :)
User avatar
deejay
Forum Contributor
Posts: 201
Joined: Wed Jan 22, 2003 3:33 am
Location: Cornwall

Post by deejay »

see this post viewtopic.php?t=6521

for example

page1

Code: Select all

<?php
<?php

session_start();

if ( !isset($_SESSION['username']) ) {
   $_SESSION['username'] = 'jason';
}

echo '$_SESSION[username] equals '.$_SESSION['username'];
echo '<br><br><a href="page2.php">Go to page 2</a>';

?>
?>

page 2

[php<?php

session_start();

echo '$_SESSION[username] equals '.$_SESSION['username'];
echo '<br><br><a href="page3.php">Go to page 3</a>';

?>

hope this helps
mleskine
Forum Newbie
Posts: 7
Joined: Fri Feb 14, 2003 6:44 am

Post by mleskine »

thanks, works well.
Post Reply