javascript: problem in window.open with URL wich contains quote/apostrophe

Hi, I've got problem with URL containing apostrophe (quote)

tried different ways but no one is working....

the following code is in PHP and javascript

the problem is that when $tabCol2[0] variable contains quote it does not open anything.....

thanks for your help.
function openwindow(arg1,arg2,arg3)
{
	window.open(arg1,arg2,arg3);
}



<a  href="javascript:openwindow('<?echo"modifier/enduser.php?type=enduser&pDevis=$pDevis&tmp=1&pEnd_user=$pEnduser&oldEndUser=".urlencode("$tabCol2[0] (CT:$pEnduser)");?>','','toolbar=no,resize=yes,location=no,directories=no,status=no,menubar=no,scrollbars=auto,copyhistory=no,width=1000,height=300,top=50,left=50')" >zzzzzzzzzz</a>

Open in new window

bruno_boccaraAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kim WalkerWeb Programmer/TechnicianCommented:
Try escaping the quote with a backslash (\").
0
Kim WalkerWeb Programmer/TechnicianCommented:
Sorry, I don't think that'll work. Try using the character entity &quot;
0
Ray PaseurCommented:
You might want the PHP function urlencode()
http://us3.php.net/manual/en/function.urlencode.php
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

leakim971PluritechnicianCommented:
try this :


<a  href="javascript:openwindow('<?echo"modifier/enduser.php?type=enduser&pDevis=$pDevis&tmp=1&pEnd_user=$pEnduser&oldEndUser='+encodeURIComponent(\"". addslashes($tabCol2[0] (CT:$pEnduser)) . "\"));?>','','toolbar=no,resize=yes,location=no,directories=no,status=no,menubar=no,scrollbars=auto,copyhistory=no,width=1000,height=300,top=50,left=50')" >zzzzzzzzzz</a>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bruno_boccaraAuthor Commented:
no one of these solution are working.....
getting crazy.
0
Kim WalkerWeb Programmer/TechnicianCommented:
Try letting javascript encode the uri.
function openwindow(arg1,arg2,arg3)
{
        window.open(encodeURI(arg1),arg2,arg3);
}

Open in new window


You can also try converting the quote to character entities in PHP.
htmlspecialchars(urlencode("$tabCol2[0] (CT:$pEnduser)"),ENT_QUOTES)

Open in new window


If that doesn't work, can you expound on the problem? Does a blank window open? Does a window open at all? Are the query string values corrupted when it gets to the PHP processor? Is a javascript error being invoked? What version of PHP are you using?

Can you post an example?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.