Got JavaScript error when using PHP's include()...
| From: | Scott Fletcher | Date: | Thu, 15 Jul 2004 21:24:53 +0000 |
| Subject: | Got JavaScript error when using PHP's include()... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-190635@lists.php.net to get a copy of this message | ||
When an include file contain plain JavaScript codes, with the echo command
before and after the include file. I get the javascript error saying
"undefined jsTest"... Anyone know why is that?
--snip--
echo "<table><tr><td></td></tr></table>";
echo "<script type='text/javascript'>";
include('test.inc');
echo " var jsTest = 0; ";
echo "</script>";
echo "<form><input type='button></form>";
--snip--
Let's say the script in the test.inc contain
--snip--
function test() {
if (jsTest != 0) {
//blah blah balh...
}
}
--snip--
Thanks,
FletchSOD