jquery - What language(s) i have to use to make a success or an error situation for PHP mail form? -
i've got php mail form coded :
and appear banner coded using css , jquery, if form succeed send mail, or not :
i know language use make happens ? advices ?
here html code form :
<form id="my_form" enctype="multipart/form-data" method=post action=formmail.php> <input type="hidden" name="subject" value="formmail"> <!-- pseudo --> <p> <h3> pseudo <font class="color-red"> * : </font> <span class="padding1"><input type="text" class="form-control" name="pseudo" aria-required="true" aria-invalid="false"></span></p><br> <!-- email --> <p> email <font class="color-red"> * : </font> <span class="your-email padding1"><input type="email" class="form-control" name="email" aria-required="true" aria-invalid="false"></span></p><br> <!-- moto --> <p> quote <font class="color-red"> * : </font> <span class="moto padding1"><input type="moto" class="form-control" name="moto" aria-invalid="false"></span> </p><br> <!-- link of gif --> <p> link of gif <font class="color-red"> * : </font> <span class="link-url padding1"><input type="link_url" class="form-control" name="link_url" aria-invalid="false"></span> </p><br> <!-- recaptcha --> <div align="center"> <p><div class="g-recaptcha" data-sitekey="6lehfqotaaaaamhlos6vgktrcdfo485aohwmp9cp"></div></p><br><h3> <!-- submit --> <p><input type="image" src="img/submitbutton.png" value="send"/><img class="ajax-loader" src="http://s584101063.onlinehome.fr/wp-content/plugins/contact-form-7/images/ajax-loader.gif" alt="envoi en cours ..." style="visibility: hidden;"></p></div> </div> </form>
here php :
if($_server["request_method"] === "post") { //form submitted //check if other form details correct //verify captcha $recaptcha_secret = "my_secret_recaptcha"; $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secret."&response=".$_post['g-recaptcha-response']); $response = json_decode($response, true); if($response["success"] === true) { header("location: my_website"); $to = "my_mail"; $subject = "submission"; $h = "from: " . $_post['email']; $pseudo = $_post['pseudo']; $email = $_post['email']; $link_url = $_post['link_url']; $moto = $_post['moto']; $http_post_vars = $_post; $message = "pseudo : " . $pseudo . "\n\n " . "email : " . $email . " \n\n" . "text : " . $moto . "\n\n " . "url du gif : " . $link_url; mail($to, $subject, $message, $h); } else { $result } } ?>
very basic idea:
$test=mail($to, $subject, $message, $h); if($test){ echo 'email work'; }else{ echo 'email fail'; }
Comments
Post a Comment