RE: [PHP] php and javascript error

This is a discussion on RE: [PHP] php and javascript error within the PHP General forums, part of the PHP Programming Forums category; > -----Original Message----- > From: Brad Fuller [mailto:bfuller@cpacampaigns.com] > Sent: Wednesday, March 07, 2007 12:02 PM &...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-07-2007
Brad Fuller
 
Posts: n/a
Default RE: [PHP] php and javascript error

> -----Original Message-----
> From: Brad Fuller [mailto:bfuller@cpacampaigns.com]
> Sent: Wednesday, March 07, 2007 12:02 PM
> To: 'Ed Curtis'; 'php-general@lists.php.net'
> Subject: RE: [php] php and javascript error
>
> > -----Original Message-----
> > From: Ed Curtis [mailto:e_curtis@homes2see.com]
> > Sent: Wednesday, March 07, 2007 11:47 AM
> > To: php-general@lists.php.net
> > Subject: Re: [php] php and javascript error
> >
> >
> > >>><a href="#"

> onclick="javascript:window.open('web_forward.php?a ddress=<?
> > >>>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.

>
>
> Is it because you have given the window the name 'Web Site' which contains
> a space character? Try naming it 'WebSite' (without the space)
>
> Hopefully that is the culprit.


You should also be making sure to use urlencode() on all data that goes into
that URL.

<a href="#" onclick="javascript:window.open('web_forward.php?a ddress=<?=
urlencode($web_url) ?>&agent=<?= urlencode($agent) ?>&real_company_name=<?=
urlencode($real_company_name) ?>', 'WebSite')"> click here </a>


> > >>>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.

> >
> > Not it, I looked and there's nothing there.
> >
> > >>PS: If you want your code to validate, change the & to &amp; Add the
> > >>closing </a> tag too.

> >
> > Thanks, the &'s are now all &amp;. The closing </a> is in the script,
> > just wasn't posted in the message.
> >
> > >>PPS: It's advisable not to use the short tags, use <?php instead of <?

> >
> > Can you tell me why? Is it just a personal preference?
> >
> > Another JS call directly in front of this one works perfectly.
> >
> > <a href="#" onclick="javascript:window.open('email.php?mls=<? echo $mls;
> > ?>&amp;toagent=<? echo $agent; ?>&amp;toagentemail=<? echo $agent_email;
> > ?>&amp;tocompanyname=<? echo $real_company_name; ?>', 'Email',
> > 'width=400,height=400,scrollbars=no,resizable=yes' );">
> > Send Me Email
> > </a>
> >
> > The only difference is this call has the window options included the one
> > that doesn't work doesn't have them. I've added them just to check and
> > it didn't change anything.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:29 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0