我有这个代码的联系表单

$message = "Telephone Number: $telephone"."\n"."Job Details: $message"."\n"."Number of Pages Required: $pages"."\n"."Clients Budget: $budget";但是我不能在电子邮件中写出新的内容。我不知道我可能需要什么其他代码。谢谢。

atb arran

// Clean up the input values

foreach($_POST as $key => $value) {

if(ini_get('magic_quotes_gpc'))

$_POST[$key] = stripslashes($_POST[$key]);

$_POST[$key] = htmlspecialchars(strip_tags($_POST[$key]));

}

mb_convert_encoding($string, "UTF-8"); //AUTO DETECT AND CONVERT

mb_convert_encoding($string, "UTF-8", "latin1");

// Assign the input values to variables for easy reference

$name = $_POST["name"];

$email = $_POST["email"];

$telephone = $_POST["telephone"];

$pages = $_POST["pages"];

$budget = $_POST["budget"];

$message = $_POST["message"];

// Test input values for errors

$errors = array();

if(strlen($name) < 2) {

if(!$name) {

$errors[] = "You must enter a name.";

} else {

$errors[] = "Name must be at least 2 characters.";

}

}

if(!$email) {

$errors[] = "You must enter an email.";

} else if(!validEmail($email)) {

$errors[] = "You must enter a valid email.";

}

if(strlen($telephone) < 6) {

if(!$telephone) {

$errors[] = "You must enter a phone number.";

} else {

$errors[] = "Message must be at least 6 characters. (include area code)";

}

}

if(strlen($message) < 10) {

if(!$message) {

$errors[] = "You must enter a message.";

} else {

$errors[] = "Message must be at least 10 characters.";

}

}

if($errors) {

// Output errors and die with a failure message

$errortext = "";

foreach($errors as $error) {

$errortext .= "

".$error."";

}

die("The following errors occured:

  • ". $errortext ."

");

}

// Send the email

$to = "contact@dorsetdesigns.co.uk";

$subject = "Quote Request: $name";

$message = "Telephone Number: $telephone"."\n"."Job Details: $message"."\n"."Number of Pages Required: $pages"."\n"."Clients Budget: $budget";

$headers = 'Content-Type: text/html; charset=utf-8';

"Quote Request From: $email";

mail($to, $subject, $message, $headers);

// Die with a success message

die("Success! Your message has been sent.");

// A function that checks to see if

// an email is valid

function validEmail($email)

{

$isValid = true;

$atIndex = strrpos($email, "@");

if (is_bool($atIndex) && !$atIndex)

{

$isValid = false;

}

else

{

$domain = substr($email, $atIndex+1);

$local = substr($email, 0, $atIndex);

$localLen = strlen($local);

$domainLen = strlen($domain);

if ($localLen < 1 || $localLen > 64)

{

// local part length exceeded

$isValid = false;

}

else if ($domainLen < 1 || $domainLen > 255)

{

// domain part length exceeded

$isValid = false;

}

else if ($local[0] == '.' || $local[$localLen-1] == '.')

{

// local part starts or ends with '.'

$isValid = false;

}

else if (preg_match('/\\.\\./', $local))

{

// local part has two consecutive dots

$isValid = false;

}

else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain))

{

// character not valid in domain part

$isValid = false;

}

else if (preg_match('/\\.\\./', $domain))

{

// domain part has two consecutive dots

$isValid = false;

}

else if(!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/',

str_replace("\\\\","",$local)))

{

// character not valid in local part unless

// local part is quoted

if (!preg_match('/^"(\\\\"|[^"])+"$/',

str_replace("\\\\","",$local)))

{

$isValid = false;

}

}

if ($isValid && !(checkdnsrr($domain,"MX") || checkdnsrr($domain,"A")))

{

// domain not found in DNS

$isValid = false;

}

}

return $isValid;

}

?>和js

$(function() {

// Validate the contact form

$('#contactform').validate({

// Specify what the errors should look like

// when they are dynamically added to the form

errorElement: "label",

wrapper: "td",

errorPlacement: function(error, element) {

error.insertBefore( element.parent().parent() );

error.wrap("

");

$("

").insertBefore(error);

},

// Add requirements to each of the fields

rules: {

name: {

required: true,

minlength: 2

},

email: {

required: true,

email: true

},

telephone: {

required: true,

minlength: 6

},

message: {

required: true,

minlength: 10

}

},

// Specify what error messages to display

// when the user does something horrid

messages: {

name: {

required: "Please enter your name.",

minlength: jQuery.format("At least {0} characters required.")

},

email: {

required: "Please enter your email.",

email: "Please enter a valid email."

},

telephone: {

required: "Please enter a phone number.",

minlength: jQuery.format("At least {0} characters required.")

},

message: {

required: "Please enter a message.",

minlength: jQuery.format("At least {0} characters required.")

}

},

// Use Ajax to send everything to quote.php

submitHandler: function(form) {

$("#send").attr("value", "Sending...");

$(form).ajaxSubmit({

target: "#response",

success: function(responseText, statusText, xhr, $form) {

$(form).slideUp("fast");

$("#response").html(responseText).hide().slideDown("fast");

}

});

return false;

}

});

});

php联系人表单,PHP联系人表单布局不允许在电子邮件中添加新行相关推荐

  1. SqlServer表中添加新字段

    表中添加新字段 ALTER TABLE 表名 ADD 字段名 VARCHAR(20) NULL 表中添加自增id alter table lianxi add id int primary key I ...

  2. VBA实战技巧精粹004:在工作簿中添加新工作表

    使用Worksheets集合或Sheets集合的Add方法可以实现在指定位置添加新工作表,并且添加后的新工作表自动为活动工作表. Sub 插入新工作表并改名()     With Worksheets ...

  3. 往数据库的表中插入新行

    //方法一:用DataAdapter方法,优点:不用写insert语句且不用关心values后边的各字段的形式,如要不要加单引号之类的:缺点:插入一条记录的效率不及写单纯insert语句SqlConn ...

  4. html中表单元素中的单选框,Html表单元素及表单元素详解

    大纲 1.认识表单 2.认识表单元素 3.表单元素的分类 4.表单元素--文本框 5.表单元素button 6.表单元素--单选.多选 7.表单元素--select 8.表单元素--textarea ...

  5. 001 spring5框架:java类工程,IOC:实体类表示表关系,AOP,JdbcTemplate模板,事务操作,Spring5 框架新功能:日志,为空注解,函数式风格,juint,Webflux

    1. Spring5 框架(Spring5 Framework)介绍 1.1 概念 1.Spring 是轻量级的开源的 JavaEE 框架 2.Spring 可以解决企业应用开发的复杂性 3.Spri ...

  6. sql server无效的对象名称 - 但表列在SSMS表列表中

    本文翻译自:sql server invalid object name - but tables are listed in SSMS tables list I am attempting to ...

  7. mysql 表中添加数据类型_MySQL数据表添加字段(三种方式)

    MySQL 数据表是由行和列构成的,通常把表的"列"称为字段(Field),把表的"行"称为记录(Record).随着业务的变化,可能需要在已有的表中添加新的字 ...

  8. 列名 userid 不明确。 表结构_SQL-Server(三)表的创建和操作

    3.1表结构和数据类型 3.1.1表和表结构 表结构.组成表的各列的名称及数据类型,统称为表结构. 记录.每个表包含了若干行数据,它们是表的"值",表中的一行称为一个记录.因此表是 ...

  9. MySQL数据表添加新字段

    我们不关注约束条件,只添加字段. 在表的最后位置添加新字段(默认) 语法: ALTER TABLE 表名ADD 新字段名 数据类型 约束条件; 在表的开头位置添加新字段 语法: ALTER TABLE ...

最新文章

  1. Educational Codeforces Round 59 (Rated for Div. 2)
  2. python与matlab哪个更容易学-详解python和matlab的优势与区别
  3. Atitit 加强学生就业的规划与艾提拉的治学理念 目录 1. 思路的转换 1 1.1. 发展内需为主模型 vs 外贸模式 1 1.2. 批发模式vs 零售模式vs 1 1.3. 天堂模式vs地狱模
  4. 一年读完100本书(5/100)《创新者的窘境》2021-02-25
  5. 全国路网数据SHP、全国矢量数据 行政区划边界(省市区县乡镇)、行政地名
  6. linux下的定时任务
  7. psc格式文件 的数据库导入问题
  8. utc时间戳java_java利用时间戳来获取UTC时间
  9. 在python中正确的赋值语句为3y=x+1-在 Python 中,正确的赋值语句为 ( ) 。_学小易找答案...
  10. 华为链路聚合(路由器和交换机)
  11. 计算机系统未来发展方向论文,浅谈计算机未来发展趋势(期末论文)
  12. 2023年南京大学软件工程考研上岸必看复习经验
  13. 笨鸟的生活(小白的学习日常)
  14. JavaSE -IO流
  15. 腾讯地图数据可视化之热力图
  16. 10以内的分解与组成怎么教_如何教宝宝熟记10以内分解?
  17. 3dmax和python哪个好学_C4D和3DMAX哪个好?
  18. 有未经处理的异常: Microsoft C++ 异常: cv::Exception,位于内存位置 0x0000006A6311F318 处。
  19. auto.js对接联众的一个实例
  20. ubuntu体验python_22款神奇的Ubuntu软件,帮你的系统成为全场最佳

热门文章

  1. 区间比较_Simulink(离散PIDamp;区间检测模块)+AURIX功能安全板过流比较电路+电机结构应用与工作原理学习网站...
  2. 在学习Python中,这个知识我们一定要看一遍,记不住没关系单一定要知道,字符串常用函数用法
  3. Python File(文件) 方法
  4. PHP 与Python 读取大文件的区别
  5. Python执行系统命令的四种方法
  6. jmeter线程说明_4.centos下Jmeter+InfluxDB+Grafana环境的搭建1
  7. C语言 泛型链表 如何计算(结构体中各元素)相对内存地址?(字节对齐,结构体对齐)offsetof()函数 ( (struct X*)0 ) -> Y)语法(匿名结构体)
  8. 【哲学】社会主义与资本主义的区别
  9. python matplotlib二维平面等高线的绘制, plt.contour 与 plt.contourf, plt.clabel和plt.colorbar, plt.xticks([])
  10. rust货轮什么时候出现_与 Rust 在一起的四年