PHP / Javascript Question

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
cearlp
Forum Newbie
Posts: 4
Joined: Sat Nov 13, 2010 4:17 pm

PHP / Javascript Question

Post by cearlp »

Running PHP5 on Ubuntu and some code using javascript fails. It worked at one time but updates to Ubuntu may have caused it to fail. I can't find what has changed that may be causing the problem.
This code in the program works:
<script type="text/javascript">
function redirect() {
window.location="<?php echo $_SERVER['PHP_SELF']; ?>";
}
</script>


This code in the same program does NOT:
function confirm($msg) {
echo "<script langauge=\"javascript\">alert(\"".$msg."\");</script>";
}

The alert box is partially displayed but the data in $msg is not. The space for the msg is void.
Does anyone have any suggestions?
cearlp
Forum Newbie
Posts: 4
Joined: Sat Nov 13, 2010 4:17 pm

Re: PHP / Javascript Question

Post by cearlp »

An update to my previous post. This is a Firefox problem. The code works correctly if I use Safari or IE4 as the browser.
It works sometimes in Firefox if I hit the escape key while the alert box is displayed and the browser says that the page is still loading. Then when I resubmit the page the correct alert box displays.
Post Reply