RE: [PHP] php and javascript error




I've just run into this problem this morning....

<a href="#" onclick="javascript:window.open('web_forward.php?address=<?
echo $web_url; ?>&agent=<? echo $agent; ?>&real_company_name=<? echo
$real_company_name; ?>', 'Web Site');">

This produces an "Error on Page" in IE 7, but works perfectly in Firefox
and Netscape.

I have several other javascript calls on the page where this call
resides and all of them work perfectly except for this one. Does this
error occur because I'm sending the variables to another script that
does some logging then forwards the user to the URL or is it just a IE
quirk?


This is a JavaScript issue, but may have something to do with the data you
are echoing out in PHP. Look at the source in the browser. My guess it
that
you've got a stay quote mark in one of your PHP vars.

Edward

PS: If you want your code to validate, change the & to &amp; Add the
closing </a> tag too.
PPS: It's advisable not to use the short tags, use <?php instead of <?
in such a cases I usually use <?= $var ?> instead <?php echo $var ?>. At
least it's shorter. :)

-afan


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


.



Relevant Pages

  • XMLHttpRequest and AJAX for PHP programmers
    ... Although the concept isn't entirely new, XMLHttpRequest technology is ... There are too many PHP programmers avoiding any ... work with javascript beyond simple form validation, ...
    (comp.lang.php)
  • VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help
    ... Job is to convert that JAVASCRIPT code into SIMPLE VBA code ... Here's a bookmarklet that will tell you whether or not the browser ... JS sends request to the server (to a PHP script) ... This is the PHP script. ...
    (microsoft.public.vb.controls.internet)
  • VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help
    ... Job is to convert that JAVASCRIPT code into SIMPLE VBA code ... Here's a bookmarklet that will tell you whether or not the browser ... JS sends request to the server (to a PHP script) ... This is the PHP script. ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted
    ... Job is to convert that JAVASCRIPT code into SIMPLE VBA code ... Here's a bookmarklet that will tell you whether or not the browser ... JS sends request to the server (to a PHP script) ... This is the PHP script. ...
    (microsoft.public.vb.6.webdevelopment)
  • Re: How do we get there from here?
    ... > 'AJAX approach'? ... I am using php and ajax, ... linked to the page back to the server, which could be a php script. ... but is not an entire page) to the JavaScript. ...
    (comp.databases.pick)