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>©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>