Possible Duplicate:
Undefined variable problem with PHP function
Can someone tell me why I keep getting undefined variable error messages in my PHP include files?
<?php
$page = 1;
if (isset($_REQUEST['page'])) {
$page = $_REQUEST['page'];
}
function phpRocks() {
require("includes/dostuff.php");
}
if ($search) {
phpRocks();
}
?>
Then in dostuff.php:
<?php echo $page; ?>
This is the error I'm getting:
Notice: Undefined variable: page in /dostuff.php on line 61
Attn down voters/close requesters: Doesn't show any research effort? How so? What else should I have added? I have been stumped over this for a half hour and cannot find any other posts that answer this question. Do I need to be a PHP expert in order to post questions (therefore I wouldn't be posting any questions!)??
$pageis getting set?phpRocks()called?