Dzień dobry, od jakiegoś czasu próbuje dodać do swojego formularza zamówień weryfikacje reCaptcha od google, problem polega na tym ,że po próbie wysłania przenosi mnie bezpośrednio do formularz.php tzn domena/formularz.php i wiadomość nie zostaje wysłana.
Poniżej przesyłam kod , z góry dziękuje za pomoc w rozwiązaniu problemu
<?php
$to = 'xxxx@gmail.com';
$subject = "Nowe zlecenie";
////
$name = stripslashes($_REQUEST['name']);
$email = stripslashes($_REQUEST['mail1']);
$servicetype = stripslashes($_REQUEST['service-type']);
$vehicalmake = stripslashes($_REQUEST['vehical-make']);
$vehicalmodel = stripslashes($_REQUEST['vehical-model']);
$appointmentdate = stripslashes($_REQUEST['appointment-date']);
$appointmenttime = stripslashes($_REQUEST['appointment-time']);
$phone = stripslashes($_REQUEST['phone']);
$message = stripslashes($_REQUEST['message']);
$mail1 = stripslashes($_REQUEST['mail1']);
$msg = "";
////////////
$msg .= "Imie i nazwisko : ".$name."\r\n\n";
$msg .= "Adres e-mail: ".$mail1."\r\n\n";
$msg .= "Numer telefonu: ".$phone."\r\n\n";
$msg .= "Rodzaj uslugi: ".$servicetype."\r\n\n";
$msg .= "Typ nadwozia: ".$vehicalmake."\r\n\n";
$msg .= "Model auta: ".$vehicalmodel."\r\n\n";
$msg .= "Data wykonania: ".$appointmentdate."\r\n\n";
$msg .= "Godzina: ".$appointmenttime."\r\n\n";
$msg .= "Wiadomosc od kupujacego: ".$message."\r\n\n";
$msg .= "\r\n\n";
if (isset($_POST['submit'])) {
$secret = '6LclC3QUAXXXXXXXXXXXH1tqFCiMH';
$response = $_POST['g-recaptcha-response'];
$remoteip = $_SERVER['REMOTE_ADDR'];
$url = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=$response&remoteip=$remoteip");
$result = json_decode($url, TRUE);
if ($result['success'] == 1) {
echo 'Nie jesteś botem';
$mail = @mail($to, $subject, $msg, "From:");
}else{
echo 'Błędnie wypełnione pole reCAPTCHA';
}
}
?>
oraz część kodu html:
<div class="col-sm-12">
<textarea id="message" name="message" rows="6" placeholder="Treść wiadomości/Dodatkowe informację zlecenia"></textarea>
</div>
<div class="g-recaptcha" data-sitekey="6LclC3QUAAAAAFSb3EPDOAQmE9eo4DUX4BiCqCTN"></div>
</div>
<button type="submit" class="btn btn-default pull-right">Zamów teraz!</button>
</form>
</div>