Popup in PHP after return Success

Asked

Viewed 699 times

1

I have a contact form, simple and I would like the person to send the message, if successful, appeared a popup saying that the message was sent.

How could I do that?

To help I’ll put part of the code PHP here:

 [..] 
 $header = implode("\r\n", $headers);
 if (mail($to, $subject, $message, $header)) {
 echo "concluido";
 }

 ?>
  • 1

    If my answer helped you, you can mark it as accepted :)

1 answer

2


Elementary, my dear Watson:

 [..] 
 $header = implode("\r\n", $headers);
 if (mail($to, $subject, $message, $header)) {
            ?>
            <script language="JavaScript">
            <!--
            alert("Sucesso!");
            window.location = '/index.php';
            //-->
            </script>
            <?

 }

 ?>
  • 1

    I appreciate friend, straight what I needed

  • But it will look like this site of the Brazilian government. I advise you to use modal bootstrap or fancybox to have the minimum of elegance. There are several examples ready by internet.

  • Particularly I do not like this history of mixing php and javascript, for that there is a multitude of selectors. I prefer to put an id on some div and from it run the script

Browser other questions tagged

You are not signed in. Login or sign up in order to post.