I have made a modal pop up which is working great when a button is clicked, but what I really want is for the modal to pop up when the form button is submitted and all my validation checks are passed using PHPMailer.
The modal on the page looks like this:
<button onclick="document.getElementById('modalPopUp').style.display='block'" title="Test Modal">Modal test button …</button>
<?php require $_SERVER['DOCUMENT_ROOT'].'/Library/Includes/modalWebFormThanks.php';?>
I realise that this is a button onclick event as it is published here, but I have been unable to get my PHP form submission to just load this modal when the form passes all validation in the PHP validation code and gives the 'thank you' message. This part works great except from this segment.
I have tried moving the code out of button, into div and changing the onclick to onload, but none of this works. The modal just doesn't appear.
How do I make this same modal just appear from the PHP 'thank you' message?