Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 29th Aug 2011, 07:12 PM   #1
HyperActive Warrior
 
Join Date: 2010
Posts: 138
Thanks: 30
Thanked 7 Times in 7 Posts
Default
php include
Share on: 
fb share twitter share gplus share more share

Hey guys i have a general member.php where users go after login. I want to make it more personal.

If they are interested in surfing i want to include the contents from surfing.php, if they are interested in skiing i want to include skiing.php.

I can PRINT their interest like this
<?php print $_SESSION['interest']; ?>

skiing.php and surfing.php are in my main directory www.mywebsite.com/surfing.php
Please help
brandon2664 is offline  
Unread 30th Aug 2011, 02:54 AM   #2
Active Warrior
 
Join Date: 2011
Posts: 60
Thanks: 0
Thanked 4 Times in 4 Posts
Default
Re: php include
Share on: 
fb share twitter share gplus share more share

The include() statement includes and evaluates the specified file.
The documentation below also applies to require().
Files are included based on the file path given or, if none is given, the include_path specified. If the file isn't found in the include_path, include() will finally check in the calling script's own directory and the current working directory before failing. The include() construct will emit a warning if it cannot find a file; this is different behavior from require(), which will emit a fatal error.
If a path is defined — whether absolute (starting with a drive letter or \ on Windows, or / on Unix/Linux systems) or relative to the current directory (starting with . or ..) — the include_path will be ignored altogether. For example, if a filename begins with ../, the parser will look in the parent directory to find the requested file.
For more information on how PHP handles including files and the include path, see the documentation for include_path.
When a file is included, the code it contains inherits the variable scope of the line on which the include occurs. Any variables available at that line in the calling file will be available within the called file, from that point forward. However, all functions and classes defined in the included file have the global scope.

rainso0 is offline  
The Following User Says Thank You to rainso0 For This Useful Post:
Unread 30th Aug 2011, 05:39 AM   #3
VIP Warrior
War Room Member
 
Join Date: 2006
Location: , , USA.
Posts: 1,795
Thanks: 70
Thanked 287 Times in 259 Posts
Default
Re: php include
Share on: 
fb share twitter share gplus share more share

include $_SESSION['interest'].".php";
is the simplest way, but you need be careful that $_SESSION['interest'] is only an existing page.
KirkMcD is offline  
The Following 2 Users Say Thank You to KirkMcD For This Useful Post:
Unread 30th Aug 2011, 08:46 AM   #4
HyperActive Warrior
 
Join Date: 2010
Posts: 138
Thanks: 30
Thanked 7 Times in 7 Posts
Default
Re: php include
Share on: 
fb share twitter share gplus share more share

Thanks alot I really appreciate it.
brandon2664 is offline  
Closed Thread


Bookmarks

Tags
include, php


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 11:32 AM.