Eng Tat Chew
Eng Tat Chew

Reputation: 55

How to write a cancel confirmation window in php

Hi I have a table of bookings to be cancel but I would like to get a cancel confirmation window prompt before it can be cancelled.

I have the following code and what codes do I need to add in the line to get cancel confirmation?

if((($row['Event_status'] == 'Over')){
echo "<td><a href='CustPortal.php?booking_id=".$row['Booking_id']."'> Cancel</a></td>"; 

Upvotes: 2

Views: 188

Answers (1)

Richard
Richard

Reputation: 2815

You can use JavaScript for this:

<a href="cancel.php" onclick="return confirm('Are you sure?');">Cancel link</a>

If you want nice alerts, have a look at SweetAlert.

Upvotes: 2

Related Questions