Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67441

after submitting form in php, success message modal not loading

$
0
0

i have form which is in a modal, when the user clicks the button the modal opens and he fills the details, and after submission the details go to my mail, till here everything is fine. After the submit button, the page again loads, so i have created a modal for thanks message like below:

<?php 
if(isset($_POST['submit'])){

    $to = "contact@solutions.com"; // this is your Email address
    $from = $_POST['name1']; // this is the sender's Email address
    $first_name = $_POST['name2'];
    $last_name = $_POST['email2'];
    $last_name1 = $_POST['number1'];
    $subject = "Referal";
    $subject2 = "Bolster Referal.";
    $message = $from . " has refered the following student :" . "\n\n" . $first_name. "\n\n" .$last_name. "\n\n" .$last_name1;
    $message2 = "Your friend " . $from . " has refered you to us" ;

    $headers = "From:" . $from;
    $headers2 = "From:" . $to;
    mail($to,$subject,$message,$headers);
    mail($last_name,$subject2,$message2,$headers2); // sends a copy of the message to the sender
    //echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
    // You can also use header('Location: thank_you.php'); to redirect to another page.
    echo "<script>
         $(window).load(function(){
             $('#thankyouModal').modal('show');
         });</script>";
    }
?>

<div class="modal fade" id="thankyouModal" tabindex="-1" role="dialog"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button><h4 class="modal-title" id="myModalLabel">Thank you for pre-registering!</h4></div><div class="modal-body"><p>Thanks for getting in touch!</p></div></div></div></div>

but after the user submits the details, the thanks message popup is not loading, can anyone please tell me what coul be wrong in my doing. thanks in advance


Viewing all articles
Browse latest Browse all 67441

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>