This should be a simple question. I have this code $target = 'blah'; include 'include.php'; Now, is it possible to have include.php communicate with $target, if so how??? Thanks
In your include.php file, you can use the $target variable as if it were defined in the include file itself. # Main file $target = 'blah'; include 'include.php'; # Include file (include.php) echo $target; // outputs "blah" PHP:
See thats what I thought, but its not working, this is my exact code, cut and paste. Include.php $lin = mysql_query("SELECT * FROM link order by id asc", $link) or die ("query 1: " . mysql_error()); echo '<li><h2>LinkWork</h2>' . '<ul>'; while ($li = mysql_fetch_array($lin)) { if ($current == $li['base']) { echo ''; } else { echo '<li><a href="'.$li['web_url'].'" alt="'.$li['alt_tag'].'">'.$li['display'].'</a></li>'; } } Including file <?php $current = 'bluewidget'; include("include.php"); ?> This is on a wordpress blog if that helps. Thanks
ok, I tested it I inserted this into my page $numfive = 5; I inserted this into my include $numfour = 4; $done = $numfour + $numfive; when the page is called it returns "4" any ideas???
Why complicate things? When you debug, use the lowest forms. Echo $numfive in the included page and see if it returns anything. Peace,