我正在尝试将 html 表单提交到发送邮件的 php 文件。我在使用 ajax 之前尝试过,它表现得很奇怪,当我改为纯 html 和 php 时,它也表现得很奇怪。所以我有这个表格:
<form id="comandaform" action="send.php" method="post">
<div class="ordercol">
<label for="nume">Nume companie</label>
<input type="text" id="nume" name="nume" />
<label for="email">Email</label>
<input type="text" id="email" name="email" />
<label for="tel">Telefon (te sunam noi!)</label>
<input type="text" id="tel" name="tel" />
</div>
<div class="ordercol">
<label for="detalii">Detalii despre domeniul tau de activitate</label>
<textarea name="detalii" id="detalii"></textarea>
<input type="submit" id="submit" value="trimite"/>
</div>
</form>
处理此问题的 PHP 脚本是:
<?php
$nume = $_POST["nume"];
$mail = $_POST["email"];
$tel = $_POST["tel"];
$det = $_POST["detalii"];
$mess = "";
if(isset($nume)&&isset($mail)&&isset($tel)&&isset($det))
{
$to = 'mail@gmail.com';
$subject = 'Comanda Site100';
$message = 'Nume companie: '.$nume.'\n'.
'Telefon: '. $tel.'\n'.
'E-mail: '. $mail.'\n'.
'Detalii:\n'.
$det;
if(mail($to, $subject, $message))
{
echo "succes";
}else{
echo "fail";
}
}else{
echo "fail";
}
?>
当我尝试提交时,浏览器将找不到该send.php
文件。难道我做错了什么?