さて、私はphpコンタクトフォームの問題に直面しています。私もphpについてあまり知らないので、これは物事を難しくします。
さて、私は自分のウェブサイトの別のページで連絡先フォームを作成しましたが、問題なく機能しています。しかし、この2番目のフォームはフォームを私のメールに送信しません。
コードは次のとおりです。
<form name="orcform" method="post" action="http://www.bmvaluminios.com/formorcamento.php">
<span id="orcnome">
<label for="nome"></label>
<input name="nome" type="text" class="round_corners" id="nome" value="">
<span class="textfieldRequiredMsg">obrigatório</span></span>
<span id="orctelefone">
<label for="telefone"></label>
<input name="telefone" type="text" class="round_corners" id="telefone" value="">
<span class="textfieldRequiredMsg">obrigatório</span></span>
<span id="orcemail">
<label for="email"></label>
<input name="email" type="text" class="round_corners" id="email" value="">
<span class="textfieldRequiredMsg">obrigatório</span><span class="textfieldInvalidFormatMsg">formato inválido.</span></span>
<span id="orclocalidade">
<label for="localidade"></label>
<input name="localidade" type="text" class="round_corners" id="localidade" value="">
<span class="textfieldRequiredMsg">obrigatório</span></span> </p>
<p><span id="orcconselho">
<label for="conselho"></label>
<input name="conselho" type="text" class="round_corners" id="conselho" value="">
<span class="textfieldRequiredMsg">obrigatório</span></span> </p>
<p><span id="orcassunto">
<label for="assunto"></label>
<textarea name="assunto" cols="47" rows="15" class="round_corners_text_area" id="assunto" value=""></textarea>
<span id="countorcassunto"> </span><span class="textareaMaxCharsMsg">demasiados caracteres</span></span></p>
<input type="submit" name="submit" id="orcsubmit" value="Enviar">
</form>
そして私のPHPコード、
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<META HTTP-EQUIV="refresh" content="0;URL=obrigado.html">
<title>Orçamento Form</title>
</head>
<body>
<?php
$name=addslashes($_POST['nome']);
$phone=addslashes($_POST['telefone']);
$email=addslashes($_POST['email']);
$localidade=addslashes($_POST['localidade']);
$conselho=addslashes($_POST['conselho']);
$assunto=addslashes($_POST['assunto']);
// you can specify which email you want your contact form to be emailed to here
$toemail = "geral@bmvaluminios.com";
$subject = "Pedido de orçamento desde BMV Alumínos.com";
$headers = "MIME-Version: 1.0\n"
."From: \"".$name."\" <".$email.">\n"
."Content-type: text/html; charset=iso-8859-1\n";
$body = "Nome: ".$nome."<br>\n"
."Telefone: ".$telefone."<br>\n"
."Email: ".$email."<br>\n"
."Localidade: ".$localidade."<br>\n"
."Contacto: ".$contacto."<br>\n"
."Assunto:<br>\n"
.$assunto;
echo '<pre>';
var_dump( $_POST );
if (!ereg("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $email))
{
echo "That is not a valid email address. Please return to the"
." previous page and try again.";
exit;
}
mail($toemail, $subject, $body, $headers);
echo "Thanks for submitting your assunto";
?>
</body>
</html>
そしてフォームのあるページは、
http://www.bmvalumios.com/orcamentos.html
大変お世話になりました。