我的HTML代碼:
<form role="form" method="post" >
<fieldset>
<div class="form-group">
<input class="form-control" placeholder="Enter Your Email" name="email" type="text" autofocus>
</div>
<!-- Change this to a button or input when using this as a form -->
<input type="submit" href="dashboard.php" class="btn btn-lg btn-success btn-block btn-warning" value="Reset" name="sub">
</fieldset>
</form>
我的PHP郵件()代碼:
$email = $_POST['email'];
$to = $email;
$subject = "Password Recovery";
$full="http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$reffurl=str_replace("forget_pass_nw_pass.php","",$full);
$message = "You are receiving this e-mail because you have requested to recover your password.";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: <[email protected]>' . "\r\n";
$mail_sent = mail($to,$subject,$message,$headers);
我試圖改變
$ to = $ email
到
$到= 「[email protected]」
和它的實際工作。但是當它是$到$電子郵件,沒有電子郵件正在發送。
它簡單意味着$ _POST [ '電子郵件']要麼是空值或此指數不言。你能否顯示你的表單代碼,因爲它不在你提到的代碼中。 – 2015-03-31 08:47:28
你是否在你的PHP文件中獲得'$ _POST ['email']'的值 – 2015-03-31 08:48:32
我試過echo「$ email」;它實際上會將電子郵件用戶類型返回到表單中,而不是空字符串或錯誤字符串。 – sgchecker 2015-03-31 08:50:06