Re: PHP & Java ?
| From: | Peter Dudley | Date: | Fri, 04 May 2001 17:12:29 +0000 |
| Subject: | Re: PHP & Java ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51446@lists.php.net to get a copy of this message | ||
If it's javascript, then be careful about echoing PHP variables into
Javascript strings. If you have something like (in Javascript)
var myString = '<?php echo $phpString; ?>';
and $phpString contains any apostrophes, then the javascript will break
because Javascript thinks the string has ended prematurely. E.g, if
$phpString is "My cat's pajamas" then the javascript would be sent to the
browser thus:
var myString = 'My cat's pajamas';
and you can see that there are too many single quotes, which will, of
course, cause Javascript's high-powered debugging utilities to kick in and
give you a highly useful error report.
Pete.
> While working on some web sites which contain mouse over java, and then
> adding in some db stuff via php/mysql, the java seems to break.
> Is there something special I need to do to prevent that break?
> Is this a common problem?
> Does using templates get around that problem ?