Php 联系方式
这是我使用的代码,当我在表单中输入信息时,邮件会发送不完整的电子邮件,例如,如果我在所有字段中添加1以及电子邮件名称等,它会显示: 发件人:Php 联系方式,php,contact-form,Php,Contact Form,这是我使用的代码,当我在表单中输入信息时,邮件会发送不完整的电子邮件,例如,如果我在所有字段中添加1以及电子邮件名称等,它会显示: 发件人: 电子邮件: 故事: 短信: 数据: 列夫兰德:r: Ekstra信息: 所以我缺乏信息 <?php $name = $_POST['f_name']; $email = $_POST['email']; $tale = $_POST['tale']; $sms = $_POST['sms']; $data = $_
电子邮件:
故事:
短信:
数据:
列夫兰德:r:
Ekstra信息: 所以我缺乏信息
<?php
$name = $_POST['f_name'];
$email = $_POST['email'];
$tale = $_POST['tale'];
$sms = $_POST['sms'];
$data = $_POST['data'];
$levrandor = $_POST['levrandor'];
$ekstra = $_POST['ekstra'];
$formcontent="From: $name \n Email: $email \n Tale: $tale \n Sms: $sms \n Data: $data \n Levrandør: $levrandor \n Ekstra informasjon: $ekstra";
$recipient = "post@mobilavtalen.no";
$subject = "Melding fra bruker.";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
if(mail){
header('Location: thanks.html');
}else{ echo "Email ble ikke sendt";}
?>
HTML格式:
<div class="form_area text-left">
<form id="contact-form" action="mail.php" method="post">
<fieldset>
<label>Navn:</label>
<input type="text" placeholder="">
<label>E-mail: (Må fylles inn)</label>
<input type="email" placeholder="" required>
<label>Forbruk pr mnd (Må fylles inn):</label>
<label>Tale:</label>
<input type="text" placeholder="" required>
<label>Sms:</label>
<input type="text" placeholder="" required>
<label>Data:</label>
<input type="text" placeholder="" required>
<label>Levrandør:</label>
<input type="text" placeholder="" required>
<label>Ekstra informasjon:</label>
<textarea rows="3"></textarea><br>
<!--<input type="submit" id="submit_button" class="btn" value="Send">-->
<button name="submit" type="submit" id="submit_button">Send</button>
</fieldset>
</form>
</div>
导航:
电子邮件:(Måfyles酒店)
弗布鲁克民宿酒店(Måfyles inn):
故事:
短讯服务:
数据:
列夫兰多尔:
Ekstra信息:
发送
您需要在表单字段上设置name属性
name
属性应与您在$\u POST
数组中使用的键相同。例如:
<input type="text" name="f_name" placeholder="">
你可以阅读更多关于$\u POST
数组的信息。那么你想在电子邮件中包含发布的数据吗?PHP代码看起来不错,可能是HTML表单中的错误。你能把它的代码贴出来吗所以他们需要匹配?上帝:没错。$\u POST
数组是由表单中的名称
属性索引的。好吧,除了底部的“ekstra informasjon”部分外,它对所有部分都有效。您可以将文本区域上的名称
属性设置为ekstra
?
$name = $_POST['f_name'];