Solved

PHP Code for Pop Up Message

Posted on 2013-01-28
4
325 Views
Last Modified: 2013-01-28
I have the following line of code in one of my .php pages.

<td> <center> <a href="assign.php?id=<?php echo $row['fid'];?>"> <center> Assign </center> </a> </center> </td>

Open in new window


When a user clicks on the ASSIGN link on th epage they get sent to the assign.php page. My question is, how can I edit this line of code so when a user clicks the ASSIGN link, a pop up box will pop up saying are you sure, bla bla bla, if so click OK" & once they click OK, they get sent to the assign.php page?

I've tried using javascript onclick commands but just can't seem to get it right. Can someone help me out?
0
Comment
Question by:wantabe2
  • 2
4 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 38828090
Use:

Var result=confirm('some Message');
http://www.w3schools.com/jsref/met_win_confirm.asp
0
 
LVL 15

Author Comment

by:wantabe2
ID: 38828397
I think that's more than I need in the example from the website. I tried this & it's not working either:

<td><center><a href="assign.php?id=<?php echo $row['fid'];?>"> Var result=confirm('some Message');Assign</center></a></td>
0
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 500 total points
ID: 38828479
You can actually use the return value from confirm() directly to cancel the click on the link:
<a href="assign.php?id=x" onclick="return confirm('Are you sure?');"> <center> Assign </center> </a>

Open in new window

0
 
LVL 15

Author Closing Comment

by:wantabe2
ID: 38828524
After editing it, Your code did exaclty what I needed it to do. Thanks
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn how to count occurrences of each item in an array.
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 …

743 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

10 Experts available now in Live!

Get 1:1 Help Now