Solved

javascript in php

Posted on 2011-02-21
2
842 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
form button worked now it doesnt anymore 9 40
How to turn a javascript bookmark into a hyperlink online 9 30
datetime in sql 6 24
jQuery not working on ELSE... why? 2 21
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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 …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

911 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

21 Experts available now in Live!

Get 1:1 Help Now