我需要幫助。我需要做什麼來驗證此表單中的電子郵件?這是一個登錄頁面,我想在訪問我的內容here is this demo之前獲取訪問者的電子郵件。HTML表單工作,但需要php驗證
我可以得到一些提示或正確的代碼用於此頁面嗎?
<form id="contact-form" action="send.php">
<input type="text" name="email" placeholder="[email protected]" class="cform-text" size="40" title="your email" required>
<input type="submit" value="Enter Now" class="cform-submit">
</form>
send.php文件:
$visitorEmail = $_GET['email'];
$email_from = "[email protected]";
$email_subject = "New Form Submission! - From: " + $visitorEmail;
// edit here
$email_body = "New visitor - $visitorEmail";
$to = "[email protected]";
$headers = "From: $email_from \r \n";
$headers .= "Reply-To: $visitorEmail \r \n";
mail($to, $email_subject, $email_body, $headers);
header("Location: http://www.de-signs.com.au");
謝謝!
http://www.sitepoint.com/form-validation-with-php/ – AdRock