0
我有一個表單並且表單正在工作:我收到我電子郵件上的所有詳細信息。但是當我點擊提交時,它會重定向到一個空白頁面,內容是:「請求已成功提交,我們會盡快與您聯繫。」表單驗證輸出不起作用
我想什麼做的是顯示一個綠色的盒子說,表單已成功提交,在同一頁上最喜歡的網站做的,而不是重定向...
我使用引導:)
Mailer.php代碼:
<?php
$tipoIn = $_POST['tipoIn'];
$Tipologia_input = $_POST['Tipologia_input'];
$sender_name = $_POST['Nome'];
$sender_email = $_POST['email'];
$phone = $_POST['Telefone'];
$slider_value = $_POST['slider_value'];
$mail_body = $_POST['message'];
$body = $sender_name." sent a new message for you<br><br> Name: ".$sender_name."<br>Email: ".$sender_email."<br>Phone: ".$phone."<br>Tipo: ".$tipoIn."<br>Tipologia: ".$Tipologia_input."<br>Slider Value: ".$slider_value."<br>Message: ".$mail_body;
sendMail($sender_name , $sender_email, $body);
function sendMail($sender, $sender_mail, $body) {
$to = '[email protected]'; // Set Receiver Email Here
$myemail = '[email protected]'; // Set Sender Email Here
$subject = "New EasyLoan Client"; // Set Subject Here
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: Lead <[email protected]>\r\n"; // Set Header Here
$message = $body;
$sentmail = mail($to,$subject,$message,$headers);
if($sentmail) { echo "Request submitted successfully. We will contact with you very soon."; }
else { echo "Mail not sent"; }
}
?>
表單代碼:
<div class="form-container">
<div class="form-mockup">
<h2>Que imóvel procura ?</h2>
<!-- <h4>Easy to apply for a loan with us,Once you have complete this form. </h4>-->
<form action="mailer.php" method="post">
<div class="form-group">
<select class="form-control" id="tipo" name="tipoIn">
<option value="Tipo" disabled selected>Tipo de imóvel</option>
<option value="Moradia">Moradia</option>
<option value="Apartamento">Apartamento</option>
</select>
</div>
<div class="form-group">
<select class="form-control" id="tipologia" name="Tipologia_input">
<option value="Tipologia" disabled selected>Tipologia</option>
<option value="T1">T1</option>
<option value="T2">T2</option>
<option value="T3">T3</option>
<option value="T4">T4</option>
<option value="T5">T5</option>
</select>
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Nome Completo" name="Nome">
</div>
<div class="form-group">
<input type="email" class="form-control" placeholder="E-mail" name="email">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Telefone" name="Telefone">
</div>
<div class="form-group">
<textarea class="form-control" rows="3" id="comentario" placeholder="Diga-nos como imagina a sua casa..." name="message"></textarea>
</div>
<div class="form-group">
<div class="button-slider">
<div class="btn-group btn_group">
<div class="btn btn-default btn_amount">Valor </div>
<div class="btn btn-default btn_slider">
<input id="bootstrap-slider" type="text" data-slider-min="1" data-slider-max="50000" data-slider-step="1" data-slider-value="25000" name="slider_value" />
<div class="valueLabel"><span class="text_span">Valor </span> <span id="sliderValue">25000</span>€</div>
</div>
</div>
</div>
</div>
<button type="submit" class="btn btn-default quote_btn">Enviar</button>
</form>
</div>
</div>
我使用bootstrap,不知道它是否有幫助。 –
通過框架,我的意思是像'laravel'這樣的'php'框架或像AngularJS這樣的一些邏輯前端框架,Bootstrap只是一個圖形框架,意思是它不會告訴什麼時候顯示一條消息。 – MaMadLord