I’m having a problem whereby vars that i have stated in an external php script aren’t showing in part of a page that’s being loaded in later, by jquery.
The simplified code:
index.php:
<?php
require_once "init.php";
?>
//the rest of the page is added here.
init.php
<?php
$test = 'foo';
?>
home.php
<?php
echo $test;
?>
When a div is clicked, jquery will use .load to add ‘home.php’ into the page.
The problem is that the $test var isn’t showing, because the ‘init.php’ hasn’t been run with ‘home.php’ on the page. Is there any way i can fix this?
Thanks
I guess the only solution is to include init.php in home.php
Othervise the variable will be undefined.