Solved

javascript in php

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How would I do this...? 2 28
How can I make this form submit to itself? 10 27
Optimize simple Javascript code to use no repetitions 12 31
alert(innerHTML); 8 19
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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 …

810 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