1
私は何が間違っているのかわかりません...私はPHPフォームを提出したいと私は私のURLの外に別のページにリダイレクトしたい。これは私のコードです、私はこれの初心者ですので、どんな助けも非常に高く評価されています。HTML、PHPフォームを送信してエラーをリダイレクト
コード:
<?php
if(empty($_POST['fname1']) && strlen($_POST['fname1']) == 0 || empty($_POST['lname1']) && strlen($_POST['lname1']) == 0 || empty($_POST['email1']) && strlen($_POST['email1']) == 0 || empty($_POST['address1']) && strlen($_POST['address1']) == 0 || empty($_POST['city1']) && strlen($_POST['city1']) == 0 || empty($_POST['cel1']) && strlen($_POST['cel1']) == 0)
{
return false;
}
$fname1 = $_POST['fname1'];
$lname1 = $_POST['lname1'];
$email1 = $_POST['email1'];
$address1 = $_POST['address1'];
$city1 = $_POST['city1'];
$cel1 = $_POST['cel1'];
$veg_24176 = $_POST['veg_24176'];
$soy_24176 = $_POST['soy_24176'];
$glu_24176 = $_POST['glu_24176'];
$lac_24176 = $_POST['lac_24176'];
$chili_24176 = $_POST['chili_24176'];
$nuts_24176 = $_POST['nuts_24176'];
$choco_24176 = $_POST['choco_24176'];
$comments1 = $_POST['comments1'];
$to = '[email protected]'; // Email submissions are sent to this email
// Create email
$email_subject = "Message from NUEVA.";
$email_body = "You have received a new message. \n\n".
"Fname1: $fname1 \nLname1: $lname1 \nEmail1: $email1 \nAddress1: $address1 \nCity1: $city1 \nCel1: $cel1 \nVeg_24176: $veg_24176 \nSoy_24176: $soy_24176 \nGlu_24176: $glu_24176 \nLac_24176: $lac_24176 \nChili_24176: $chili_24176 \nNuts_24176: $nuts_24176 \nChoco_24176: $choco_24176 \nComments1: $comments1 \n";
$headers = "MIME-Version: 1.0\r\nContent-type: text/plain; charset=UTF-8\r\n";
$headers .= "From: [email protected]\n";
$headers .= "Reply-To: $email1";
mail($to,$email_subject,$email_body,$headers);
return true;// Post message
ob_start();
exit(header("Location: http://example.com/thankyou.html"));
?>
あなたのコードを投稿してください。 – bfontaine
@bfontaineコードが編集パイプラインでロックされています – Jeff
'return true'を取り除く! – Jeff