Solved

javascript in php

Posted on 2011-02-21
2
844 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
ID: 34947485
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
ID: 34947494
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

808 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