954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

PHP includes & variables

I don't have much time to say this but I'm going to try and hurry...

Here's a snippet of code:

$subName = "someName";

include "contentHeader.php";

Inside of contentHeader:echo $subName;

--------------------------

I know that this variable is correct because I had tried to use it on the original page that has the include file and it works. However when I try to echo it using the include page, it does not work. I can't explain in great detail right now but all I know is I need to get that variable from the original page and allow it to echo in contentHeader. What could I be doing wrong?

Thanks!! Sorry for the rush, hope you can answer
--Mike

Mikeish
Newbie Poster
20 posts since Sep 2006
Reputation Points: 11
Solved Threads: 0
 

That looks like that should work. Is an error message being displayed? Maybe set error reporting to report all errors. If there is a minor issue that may report it to you.

stymiee
He's No Good To Me Dead
Moderator
3,360 posts since May 2006
Reputation Points: 161
Solved Threads: 38
 

Found out that I typed in the wrong address to you and I was using a full-length

My bad, I'm sorry.. thanks tho!
--Mike

Mikeish
Newbie Poster
20 posts since Sep 2006
Reputation Points: 11
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You