0

I'm trying to have the Modal pop up when the user successfully submits the contact form and an alternative modal when the form is unsuccessful The modal can be tested by clicking on the 'CONTACT ME'.

Basically just a simple pop-up window that is prettier than an alert box to tell the user their for has sent correctly.

The URL is: mike-griffin.com/contact.html

The PHP I'm using for the form submit is below:

<?php

/*subject and email variables*/

$emailSubject = 'Subject';
$webMaster = 'michaelgriffin87@me.com';

/*gathering data variables*/

$nameField = $_POST['Name'];
$emailField = $_POST['E-mail'];
$commentField = $_POST['Comment'];


$to = "$webMaster";
$subject = "$emailSubject";
$message = "<html>
<head></head>
<body>
<strong>Website Contact Form</strong><br />
<br />
Customer's Name: <strong>$nameField</strong><br />
E-mail Address: <strong>$emailField</strong><br />
Message:<br /><strong>$commentField</strong>



</body>
</html>
";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "To: Amorae Bridal <$webMaster>" . "\r\n";
$headers .= 'From: Website Contact Form <'.$email.'>' . "\r\n";

mail($to, $subject, $message, $headers); //<-- function to send email

$theResults = <<<EOD

EOD;
echo "$theResults";
?>

The Page Jquery/HTML for the Modal is below:

<div id="contact-sent" class="reveal-modal">

  <h1>sent</h1>

<a href="#" class="close-reveal-modal"><img src="img/close.png" alt="Close button"></a>
</div><!--modal-->

</div><!--end-of-container-->
<script src="js/main.js"></script>

<script src="js/jquery-1.4.4.min.js"></script>
<script src="js/jquery.reveal.js"></script>
<script>
 //code that uses 1.4.4 should be enclosed as follows
 jQuery(function( $ ) {

    (jquery);

 $('#contact-sent').reveal({
 animation: 'fadeAndPop',                   //fade, fadeAndPop, none
 animationspeed: 300,                       //how fast animtions are
 closeonbackgroundclick: true,              //if you click background will modal close?
 dismissmodalclass: 'close-reveal-modal'    //the class of a button or element that will close an      open modal
});
});

</script>
esqew
  • 42,425
  • 27
  • 92
  • 132
ironmike
  • 143
  • 2
  • 13
  • Page is a bit of a mess. Why are the scripts not in the document head? – Roamer-1888 Dec 09 '14 at 22:52
  • And why jQuery 1.4.4, which is really ancient? Many useful features and bug fixes have been introduced since. – Roamer-1888 Dec 09 '14 at 22:54
  • 1
    Oh dear, then jQuery 1.11.1 appears further down. There's a lot to fix before attempting improvements. – Roamer-1888 Dec 09 '14 at 22:57
  • There are 2 versions of jquery included, 1.4.4 and 1.11.1, and the error in line 86 `jquery is not defined` because of `(jquery)` – matthias_h Dec 09 '14 at 22:57
  • @Roamer-1888 The modal would only work using 1.4.4, I was originally just using 1.11.1 but the modal only worked with 1.4.4 so I added both... – ironmike Dec 09 '14 at 23:03
  • 1
    If I were you, I'd find a more up to date modal plugin - there are many to choose from and one that works under jQuery 1.11 will not be hard to find. – Roamer-1888 Dec 09 '14 at 23:08
  • @Roamer-1888 you may be right I shall look for something, but is what I'm trying to achieve simple to do and would you know how? Also I have simple put the script in the Body as I read that it makes the site load quicker. (http://stackoverflow.com/questions/10994335/javascript-head-body-or-jquery) is where I was reading it. – ironmike Dec 10 '14 at 00:15
  • I can't help more as I don't fully understand the question. – Roamer-1888 Dec 10 '14 at 00:19

0 Answers0