Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Confirm Delete of link with PHP and Javascript

Posted on 2011-09-15
3
Medium Priority
?
326 Views
Last Modified: 2012-05-12
How do I add a PHP Variable to the onclick confirm statement. Right now i can get it to only say are you sure you want to delete this? I would like to replace the "this" with a php variable $ID but its not working.
<a href='.$deletethis.$row[$colID].'" onclick="javascript:return confirm(\'Are you sure you want to delete this?\')">'.$deleteIMG.'</a>';

Open in new window


I want it to do this but its not working.
<a href='.$deletethis.$row[$colID].'" onclick="javascript:return confirm(\'Are you sure you want to delete $ID ?\')">'.$deleteIMG.'</a>';

Open in new window

0
Comment
Question by:phat_code
[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
3 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 36545965

echo '<a href="' . $deletethis.$row[$colID] . '" onclick="javascript:return confirm(\'Are you sure you want to delete " . $ID . '?\')">' . $deleteIMG . '</a>';

Open in new window

0
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 36545972
correction :
echo '<a href="' . $deletethis.$row[$colID] . '" onclick="javascript:return confirm(\'Are you sure you want to delete ' . $ID . '?\')">' . $deleteIMG . '</a>'; 

Open in new window

0
 

Author Comment

by:phat_code
ID: 36546127
oops I was missing the quotes thank you!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

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?
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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)
Suggested Courses

636 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