tc101
July 31st, 2008, 03:17 AM
How do I pass a variable to an include in PHP? For example in the two simple files below, how would I pass a variable from test.php to include.php? I know how to do this with a form using $_POST, but I can't figure out how to do it in an include.
test.php
<html>
<body>
<b>first html</b>
<p>
<?php
include 'include01.php';
?>
<p>
<b>last html</b>
</body>
</html>
include.php
<?php
echo "this comes from the include";
?>
test.php
<html>
<body>
<b>first html</b>
<p>
<?php
include 'include01.php';
?>
<p>
<b>last html</b>
</body>
</html>
include.php
<?php
echo "this comes from the include";
?>