0

I'm having trouble figuring out how to have a nice popup that thanks the user for their form submission. On my hosting site, I'm using a .php page that sends me an email (form mail feature) after the form has been submitting. In my website code, I have a redirect to a thank you page. But, I'm not sure how to have the popup go to the redirect thank you page (thankyou.html) so I can style it (instead of using the default browser popup). I still want to make sure the .php file is used to send to my gmail account.

Form in my website:

<div id="container-footer">
<form action="gdform.php" method="post" id="contact">
<fieldset class="wrapper"><legend>Contact</legend> 
<input type="hidden" name="subject" value="Submission" />
<input type="hidden" name="redirect" value="/thankyou.html" />
<ul class="group">
<li class="name"><label for="name">Your Name</label> <input id="name" name="name" type="text" /></li>
<li class="email"><label for="email">Your Email</label> <input id="email" name="email" type="email" /></li>
<li class="message"><label for="message">Say Hello</label><textarea id="message" name="message"></textarea></li>
</ul>
<input class="send" name="submit" type="submit" value="Send" />


</fieldset>
</form>


<footer class="wrapper" id="colophon">
<p>&copy;2014 all rights reserved.</p>
</footer>
</div>

gdform.php

<?php
$request_method = $_SERVER["REQUEST_METHOD"];
if($request_method == "GET"){
  $query_vars = $_GET;
} elseif ($request_method == "POST"){
  $query_vars = $_POST;
}
reset($query_vars);
$t = date("U");

$file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;
$fp = fopen($file,"w");
while (list ($key, $val) = each ($query_vars)) {
 fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
 fputs($fp,"$val\n");
 fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
 if ($key == "redirect") { $landing_page = $val;}
}
fclose($fp);
if ($landing_page != ""){
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
} else {
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
}


?>

thankyou.html (I'd like this in the nice jQuery or other than browser popup)

<h1>THANK YOU!</h1>

<p>Thank you for contacting me. I'll get back with you as soon as possible.</p>
user3421142
  • 13
  • 1
  • 4

1 Answers1

0

You could probably make the popup using Jack Moore's jQuery Modal. Then, you can call that JS function with your PHP code.

I'm not the best in this field, so someone else can probably give a better, more definitive answer.

Community
  • 1
  • 1
Orangestar
  • 176
  • 1
  • 8
  • Thank you. I'm no expert at this, so I would like some help, if possible, in what I can add to my current code to have it function as I indicated. I know it's not an easy fix :-) – user3421142 Mar 15 '14 at 00:59