$('#profileclick').click(function(){    
     alert('Your details have been updated');
     $('#profile').submit();
});


$('#profile').submit(function( e ){
         e.preventDefault();

         // ........ AJAX SUBMIT FORM
});

Or simply add a delay before you submit using setTimeout ...

$('#profileclick').click(function(){    
     alert('Your details have been updated');
     setTimeout(function(){
             $('#profile').submit();
     }, 2000);        
});
Answer from Roko C. Buljan on Stack Overflow
🌐
University of Washington
washington.edu › accesscomputing › webd2 › student › unit5 › module2 › lesson1.html
Using JavaScript to Show an Alert
The button includes the onclick attribute, which causes the showAlert() to be called when a user clicks the button. The onclick event also works for keyboard users. If a user navigates to the button using the tab key, then presses enter, that too will trigger the alert.
🌐
Bytes
bytes.com › home › forum › topic › php
Onclick Alert popup in php - Post.Byes
........... <?php srand((double) microtime() * 1000000); $readfile = file("filetest. txt"); $k=rand(0, sizeof($readfil e)-2); list($quest,$an sw) = split("/",$readfile[$k]); print("$quest<B R>$answ<br>"); ?> <button onClick="alert( 'Question is : <?=$quest?>')"> Question1</button> <button onclick="alert( <?php echo "'Question is : " . $quest ."'"; ?>)">Question2 </button><BR> <button onClick="alert( 'Answer is : <?=$answ?>')">A nswer1</button> <button onclick="alert( <?php echo "'Answer is : " . $answ ."'"; ?>)">Answer2</button> <script> <?php echo "var V='" . $answ ."';"; ?> </script> <button onclick="alert( V)">click</button> ...............
🌐
GeeksforGeeks
geeksforgeeks.org › php › how-to-pop-an-alert-message-box-using-php
How to Pop an Alert Message Box using PHP? - GeeksforGeeks
July 12, 2025 - Using this you can alert to the user with some information and message. PHP doesn't support alert message box because it is a server-side language but you can use JavaScript code within the PHP body to alert the message box on the screen.
🌐
Simplilearn
simplilearn.com › home › resources › software development › alert in php: displaying an alert message box in php
Alert in PHP: Displaying An Alert Message Box in PHP
January 26, 2025 - Deep dive into alert in PHP tutorial and learn how to display an ⚠️ alert message box in PHP, types of pop-up boxes with examples. Start learning now!
Address   5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
W3Schools
w3schools.com › howto › howto_js_alert.asp
How To Create an Alert Message Box
If you want the ability to close the alert message, add a <span> element with an onclick attribute that says "when you click on me, hide my parent element" - which is the container <div> (class="alert"). Tip: Use the HTML entity "&times;" to ...
🌐
DaniWeb
daniweb.com › programming › web-development › threads › 176225 › onclick-confirm-on-button-help
php - onclick confirm on button help [SOLVED] | DaniWeb
<button type="button" id="submitPayment">Submit Payment</button> <script> document.getElementById('submitPayment').addEventListener('click', function (e) { if (confirm('Are you sure you want to submit this payment transaction?')) { window.location.href = 'bpipaymentover.php'; } }); </script>
Find elsewhere
🌐
W3Schools
w3schools.com › jsref › met_win_alert.asp
Window alert() Method
The alert() method displays an alert box with a message and an OK button.
🌐
STechies
stechies.com › display-alert-message-box-dialogue-box-using-php
How to Display Alert Message Box in PHP?
To pop an alert message via PHP, we need to render JavaScript code in PHP and send it to the browser. JavaScript is a client-side language. ... <html> <head> <meta charset="utf-8"> <title>JavaScript Alert Box by PHP</title> <?php echo '<script ...
🌐
Javatpoint
javatpoint.com › php-alert
PHP alert - javatpoint
PHP alert with examples, php file, php session, php date, php array, php form, functions, time, xml, ajax, php mysql, regex, string, oop, addslashes(), addcslashes() etc.
Top answer
1 of 3
1

Alert is a special kind of method which is only used for Showing some messages,with a button is attached.Only we can write text in it.If you want an alert box with your own components, design a new one yourself.But it will never become an alert box.By using jquery you can do this ..paste it.

Here is the Jquery code for dialog box,paste it.

<html>
  <head>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <style></style>
  </head>
     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script>
<script src='template/js/jquery.textarea-expander.js'></script>
 <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
// <---- VENTAÑAS DE PARAMETERES---->
$(document).ready(function() { 
var regex,v,l,c,b,i,contapara=3;




$( "#wnd_Addparam" ).dialog({
            autoOpen: false,
            height: 'auto',
            width: 350,
            modal: true,
            resizable:false,
            buttons: {
                "Link": function() {
                   location.href="http://www.google.com";
    return false;  },
                Cancel: function() {
                $( this ).dialog( "close" );
                }
            },
            close: {}
        });


                $( "#wnd_Addparam" ).dialog( "open" );


                    });
</script>
  <body>

<div id="wnd_Addparam" title="Information" ></div>
</body>
</html>

Hope this will help you dr..

2 of 3
0

You can use it with JavaScript to like,

echo "<a href='onclick='javascript:function(id)''></a>";

and the javascript you can use it by,

function(id)
{
    window.location.href("file_name.php")
}
🌐
Scaler
scaler.com › home › topics › php alert
PHP alert - Scaler Topics
April 1, 2024 - Here are three commonly used types ... in PHP using JavaScript: Alert Box: The alert box is a simple pop-up box that displays a message to the user. It is typically used to convey important information or display warnings.
Top answer
1 of 5
3

This is an example to show the dissmissable alert box when clicking on a button.

$(document).ready(function() {
  $('.activater').click(function() {
    $('.alert').show()
  })
});
.alert {
  display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" />

<body>
  <div class="container">
    <h2>Dismissal Alert Messages</h2>
    <button class="activater">Send Message</button>
    <a class="activater">SHOW MESSAGE</a>
    <div class="alert alert-success alert-dismissable">
      <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
      Success! message sent successfully.
    </div>

  </div>
</body>

2 of 5
2

You can achieve it through Bootstrap modal instead of alert box. You can design it as according to your need.

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
click on this link : 
  <!-- Trigger the modal with a button -->
  <span data-toggle="modal" data-target="#myModal">www.google.com</span>

  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">
    
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Modal Header</h4>
        </div>
        <div class="modal-body">
          <p>Alert Box. Click 'OK' to go to www.google.com</p>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" onClick="document.location.href='www.google.com'">Go</button>
        </div>
      </div>
      
    </div>
  </div>
  
</div>

</body>
</html>

🌐
Scriptcase
forum.scriptcase.net › developers › programming
Clicking on a button I have to show a initial message with if - Programming - Scriptcase Low-code
June 1, 2015 - Hello all, I got a form button with php code inside. When I click on it the first message is … echo ‘<script>alert(“Attention, now it will be create an Order which will contain all rows selected All row previously se…
Top answer
1 of 1
2

By default scripts are stripped out when in visual view.

So there are a couple of options:

  1. Never use visual mode again (let's be honest, that's not going to happen ;) )
  2. Create a shortcode that will do the alert for you.

In your functions.php file add the following

/**
 * [alert_link url="https://example.com" message="This is the message" text="This is the link to click"]
 *
 * @param $atts
 * @param null $content
 *
 * @return string
 */
function my_alert_shortcode( $atts, $content = null ) {
    // Set up your defaults and read from the shortcode parameters you enter in the page.
    $atts = shortcode_atts(
        array(
            $url = '#', // This is the default URL for your shortcode should you leave that parameter blank
            $message = 'This is the message', // This would be the default message should you leave that parameter blank
            $text = 'This is the link to click', // This would be the default text that is made an anchor
        ), $atts, 'alert_link' );

    // Now format your output to include the parameters from above.
    $output = '<a class="my-alert-link" href="' . $url . '" onClick="alert(\'' . $message . '\')">' . $text . '</a>';

    return $output; // Return
}
add_shortcode( 'alert_link', 'my_alert_shortcode' ); / This registers your shortcode for use.

Once in place you'd just enter the shortcode like this and replace the default values as required:

[alert_link url="https://example.com" message="This is the message" text="This is the link to click"]

Shortcodes are a super helpful way to do things like add script or extra functionality without having to program it into the editor (which is inherently unsafe, which is why scripts get stripped).

Check out the WordPress shortcode documentation here: https://codex.wordpress.org/Shortcode_API

A quick note too on the HTML you're using. While valid, FONT tags and spans used to set font-size, family, etc. are pretty darn old and should be replaced with CSS if possible.

Checkout HTML 5 Web Developer guide for semantics etc. https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5