I expect chdir to change the cwd when I leave the script, but it does not.
Here’s the situation: A client enters my module http://localhost/lessons/recap/recap.php via http://localhost/lessons/select/select.php. Checking the $_POST determines that the client clicked the Cancel button. So I want to send the client back to the index.htm which is (despite the intermediate tour through select.php) in http://localhost/index.htm.
So I
chdir($_SERVER['DOCUMENT_ROOT']);
$html = implode('', file("index.htm"));
exit($html);
The native index.htm does show up, but without the css styling(which is a file in the document root). Sure enough, the address box in the browser shows [B]http://localhost/lessons/recap/recap.php[/B] and pressing the submit results in the dreaded 404 because it is looking for
http://localhost/lessons/recap/lessons/select/select.php
I’ve concluded I’m being way too creative in trying to encapsulate my code. I suspect I’ll simply go back and put everything in one folder and be done with it – but
Is there a way I can encapsulate without shooting myself?
Regards,
Brian Case