How to pass php variable to include page? -
when load page index.php
, why not echo $my_header
index.php
<?php include 'test.php'; $my_header = 'aaaaaaaaaaaaaaaaaaaa'; ?>
test.php
<?php echo $my_header; ?>
just change 2 lines this:
$my_header = 'aaaaaaaaaaaaaaaaaaaa'; include 'test.php';
also version should give error! if not recommend turn error reporting on this:
<?php error_reporting(e_all); ini_set("display_errors", 1); ?>
(btw: recommend use require_once
script included once , errors!)
Comments
Post a Comment