我的PHP表單對我來說工作正常,但不知何故,我收到空白的電子郵件。我試圖直接打開contact.php www.domain.com/php/contact.php,就是這樣。它發送了一封空郵件。有人可以幫我預防嗎?contact.php發送空白電子郵件
PHP
$mailTo = '[email protected]';
$mailFrom = $_POST['email'];
$mailSubject = 'Kontakt';
$returnPage = 'versand_erfolgreich.php';
$returnErrorPage = 'versand_fehler.php';
$mailText = "";
if(isset($_POST["submit_button"])) {
foreach($_POST as $name => $value) {
if(is_array($value)) {
$mailText .= $name . ":\n";
foreach($valueArray as $entry) {
$mailText .= " " . $value . "\n";
} // ENDE: foreach
} // ENDE: if
else {
$mailText .= $name . ": " . $value . "\n";
} // ENDE: else
} // ENDE: foreach
} // if
if(get_magic_quotes_gpc()) {
$mailtext = stripslashes($mailtext);
}
$mailSent = @mail($mailTo, $mailSubject, $mailText, "From: ".$mailFrom);
if($mailSent == TRUE) {
header("Location: " . $returnPage);
}
else {
header("Location: " . $returnErrorPage);
}
exit();
HTML
<form class="form1" id="formular" role="form" action="php/kontakt.php" id="subscribeForm" method="POST">
<input class="inputsolo" type="text" name="Name" id="fname" placeholder="Name*" required="required">
<input class="inputsolo" type="text" name="email" id="email" placeholder="E-Mail Adresse*" required="required">
<input class="inputsolo" type="text" name="Telefon" id="phone" placeholder="0221 111 222*" required="required">
<input class="inputsolo" type="text" name="Betreff" id="betreff" placeholder="Betreff">
<input tabindex="-1" class="inputsolo betreff2" type="text" value="1" name="Betreff2" id="betreff2" placeholder="Betreff">
<input class="inputsolo paket" type="text" name="Ausgewählt:" id="web1" value="Webpaket Basis" readonly><img class="closewahl close1" src="css/images/close.png" alt="close"></img></input>
<input class="inputsolo paket" type="text" name="Ausgewählt:" id="web2" value="Webpaket Erweitert" readonly><img class="closewahl close2" src="css/images/close.png" alt="close"></img></input>
<input class="inputsolo paket" type="text" name="Ausgewählt:" id="web3" value="Webpaket Business" readonly><img class="closewahl close3" src="css/images/close.png" alt="close"></img></input>
<input class="inputsolo paket" type="text" name="Ausgewählt:" id="web4" value="Webpaket Universal" readonly><img class="closewahl close4" src="css/images/close.png" alt="close"></img></input>
<textarea class="inputpoly" name="message" placeholder="Ihre Nachricht.." id="message"></textarea>
<p id="fehler400"><u>ACHTUNG:<br>Es ist ein Fehler aufgetreten.</u><br><small>Verdacht auf Spam-Bot.</small><br>Bitte kontaktieren Sie uns per E-Mail oder telefonisch.<br><font style="font-family:arial,sans-serif;"><a href="tel:+32221212121" style="text-decoration:none;outline:none;color:#008aff;">+32221212121</a></font></p>
<input class="blue-btn" type="submit" id="send" value="Senden">
</form>
什麼是第5行的$ valueArray?它不應該是'$價值'嗎? – NDFA