Everywhere I look it seems I keep seeing that this should work...
//parent.php
$x=1
require_once("include.php");
//include.php
echo"$x";
This should display 1, right? It does not. I get no result.
Here's what I know...
- I'm sure the include path is correct -- I can see other things from the included page.
- I'm sure that my variables were set properly and actually do exist. I can echo them in the parent page before and after the require_once.
- If I use var_dump within the required page, I get "NULL"
- I have error reporting turned on and get no errors.
As a side note, I'm also not able to use URL vars when requiring a file.
require_once("include.php?x=$x");
gives the error "Failed to open stream...")
What am I missing?
###EDITED###
I am an idiot.
PHP was correct. I was wrong. Problem solved.
I the variable in the included page was capitalized and I didn't notice.
Sorry, guys.