newbie - function is undefined
| From: | Jim Giner | Date: | Fri, 01 Apr 2011 21:07:44 +0000 |
| Subject: | newbie - function is undefined | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-312197@lists.php.net to get a copy of this message | ||
I have this code in my php script. A simple page to test out a function
that I learned from a book I bought.
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
include($root.'/../php/inc/js/getText.js');
?>
</head>
The include gets a function I wrote called getText and I have dumped the
source code of my webpage after I get the error and i see that the include
did in fact work. There is a function with that name. Here is the header
<script type="text/javascript">
function getText(e)
{
.
.
.}
</script>
</head>
In the body of my html doc built by this script I have the following lines:
echo 'para contains: ';
echo getText("p1"); ****
echo '<br><br>';
echo 'heaading contains: '.getText("h2");
?>
</body>
I get this output on the line containing the ****
para contains:
Fatal error: Call to undefined function getText() in
/home/albany/public_html/players_dir/test_gettext.php on line 23
As you can see my output starts out as I expect but then I get the undefined
function message.
What am I not doing correctly?