Solved

javascript in php

Posted on 2011-02-21
2
841 Views
Last Modified: 2012-08-14
I have a link that uses some javascript.  It is within PHP.  I'm no sure what I am doing wrong.

if (!empty($rowak['field_id_317'])) {
echo "<a href =\"#\" onClick=\"window.open('$rowak['field_id_317']','','width=900, height=800,resizable=1,scrollbars=1')\">Website</a>";  //  url						}														

Open in new window

0
Comment
Question by:rgranlund
2 Comments
 
LVL 27

Expert Comment

by:Lukasz Chmielewski
Comment Utility
Try like this:
echo "<a href =\"#\" onClick=\"window.open('".$rowak['field_id_317']."','','width=900, height=800,resizable=1,scrollbars=1')\">Website</a>";
0
 
LVL 16

Accepted Solution

by:
BurnieP earned 250 total points
Comment Utility
You need to escape $rowak['field_id_317'] quotes I think :

if (!empty($rowak['field_id_317'])) {
echo "<a href =\"#\" onClick=\"window.open('$rowak[\'field_id_317\']','','width=900, height=800,resizable=1,scrollbars=1')\">Website</a>";  //  url                                    }                                                                                    
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Add Background to a PDF Programmatically 1 19
XML Data Missing in PHP SimpleXML 8 20
Paging Using PHP 7 28
sql sentence 2 6
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now