Jump to content

How do I display something from index.php on member.php if member.php is...


ethan89

Recommended Posts

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']), 8); // 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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.