ethan89 Posted September 1, 2010 Share Posted September 1, 2010 included in index.php? I hope that wasn't confusing. Here is my complete problem: I have one page called index.php that contains: <?php $member = substr(dirname($_SERVER['PHP_SELF']), ; // This is the name of the directory include 'http://www.EXAMPLE.com/users/member.php'… ?> I have another page called member.php (the one that is included) that contains: <?php echo "$member"; ?> There is only one problem. The above code doesn't work. It won't display $member. How can I fix this? Setting a cookie didn't work. Maybe because member.php is included in index.php and I'm not going from index.php to member.php. Thank you very much for the help! I appreciate people taking their time to help other people. Link to comment https://forums.phpfreaks.com/topic/212241-how-do-i-display-something-from-indexphp-on-memberphp-if-memberphp-is/ Share on other sites More sharing options...
AbraCadaver Posted September 1, 2010 Share Posted September 1, 2010 #1, if member.php is on the same server as index.php, you don't include a URL include('users/member.php'); //or whatever the path is #2, where do you define $member? Link to comment https://forums.phpfreaks.com/topic/212241-how-do-i-display-something-from-indexphp-on-memberphp-if-memberphp-is/#findComment-1105928 Share on other sites More sharing options...
ethan89 Posted September 1, 2010 Author Share Posted September 1, 2010 I tried doing user/member.php and /user/member.php and it can never find the directory so I had to do the whole URL. Do you think this is my problem? Maybe it's not possible to do it without the whole URL since member.php is in users/ and index.php is in users/*username*/ I defined $member in index.php Link to comment https://forums.phpfreaks.com/topic/212241-how-do-i-display-something-from-indexphp-on-memberphp-if-memberphp-is/#findComment-1105930 Share on other sites More sharing options...
ethan89 Posted September 1, 2010 Author Share Posted September 1, 2010 Oh.. I put member.php in the same folder as index.php just to test that it works and it does. I guess the http:// was messing it up like you said. I have a problem though. I can't put member.php in the same folder as index.php later. How can I include member.php in index.php without using http://www if it's one folder back? :-\ Link to comment https://forums.phpfreaks.com/topic/212241-how-do-i-display-something-from-indexphp-on-memberphp-if-memberphp-is/#findComment-1105938 Share on other sites More sharing options...
ethan89 Posted September 1, 2010 Author Share Posted September 1, 2010 Thanks for your help, Abra. It turns out all I needed to do was change http://www.EXAMPLE.com/users/member.php to ../member.php. I love it when there is such a simple solution to a seemingly huge problem Link to comment https://forums.phpfreaks.com/topic/212241-how-do-i-display-something-from-indexphp-on-memberphp-if-memberphp-is/#findComment-1105952 Share on other sites More sharing options...
fortnox007 Posted September 3, 2010 Share Posted September 3, 2010 Could you tell why you can't move files from folders within the system? this seems rather odd, or are you just using ftp to update? in that case, drag the file to your desktop, browse to the right folder and drop it in there. Good thing you found a work around Link to comment https://forums.phpfreaks.com/topic/212241-how-do-i-display-something-from-indexphp-on-memberphp-if-memberphp-is/#findComment-1106666 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.