Solved

PHP Code for Pop Up Message

Posted on 2013-01-28
4
329 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

These days socially coordinated efforts have turned into a critical requirement for enterprises.
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 count occurrences of each item in an array.
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

773 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