Solved

PHP Code for Pop Up Message

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This article discusses how to implement server side field validation and display customized error messages to the client.
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)
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…

749 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