Solved

javascript in php

Posted on 2011-02-21
2
846 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to implement server side field validation and display customized error messages to the client.
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.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

726 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