联系表格 - 我是否正确创建了这个? [英] Contact Form - Did I create this properly?

查看:78
本文介绍了联系表格 - 我是否正确创建了这个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的联系表格。我是新来的联系表格,我很想知道我是否做得正确,如果有任何错误,我应该考虑修改。



< pre lang =PHP> <?php
$ first_name = $ _POST [< span class =code-string> first_name];
$ last_name = $ _POST [ last_name ];
$ email = $ _POST [ email ];
$ telephone = $ _POST [ 电话];
$ reason = $ _POST [ 原因];
$ time = $ _POST [ time ];
$ comment = $ _POST [ comment ];
$ to = ' email @ gmail。 com公司;
$ subject = ' 家长联系表格提交;


$ v1 =
< html>
< body>
< style>
h1 {color:#000066;}
table {border:1px solid黑色;背景:#e3f0ff;}
< / style>
< h1>您好,此表单已提交!< / h1>
< img src ='logo。 png'/>
< table rules ='all'style ='border-color:#ffb300;' cellpadding ='10'width ='500px'>
< tr style ='background:#ffb300;'>< td> 名字:< / td> $ first_name
< tr style ='background:#ffb300;'>< td> 姓氏:< / td> $ last_name
< tr style ='背景:#fafafa;'>< td> 电子邮件:< / td> $ email
< tr style ='background:#fafafa;'>< td> 电话:< / td> $ telephone
< tr style ='background:#fafafa;'>< td> 联系原因:< ; / td> $ reason
< tr style ='background:#fafafa;'>< td> 最佳联系时间:< / td> $ time
< tr style ='background:#fafafa;'>< td> 评论:< / td> $ comment
< / table>
< / body>
< / html>
;
$ message = $ v1 ;
$ headers = From:$ from \r\\\
;
$ headers 。= 内容类型:text / html\r\\\
;
邮件($ to,$ subject,$ message,$ headers);
echo 消息已发送.. 。; // Page RE DIRECT
// ************************************* ************************************************** *************************************** //

$ first_name = $ _POST [ first_name ];
$ last_name = $ _POST [ last_name ];
$ email = $ _POST [ email ];
$ telephone = $ _POST [ 电话];
$ reason = $ _POST [ 原因];
$ time = $ _POST [ time ];
$ comment = $ _POST [ comment ];
$ subject = ' 家长联系表格提交;
$ v1 =
< html>
< body>
< style>
#disclosure {font-size:8px; color:#333;}
h1 {color:#000066; }
table {border:1px solid black;}
< / style>
< img src ='logo.png'/>
< table rules =' all'style ='border-color:#ffb300;' cellpadding ='10'width ='500px'>
< tr style ='background:#ffb300;'>< td> 电子邮件确认
< tr我们会尽快与您联系!< br>< br> br> Admin< br>< br>关注我们:< br>< a href ='http://www.facebook.com'>< img src ='lfacebook_hover.png'width =' 18'height ='18'>< / a>< a href ='http://twitter.com'>< img src ='twitter_hover.png'width ='18'height ='18' >< / a>< a href ='http://google.com'>< img src ='gplus_hover.png'width ='18'height = '18'>< / a> < br>< div id ='披露'align ='right'>©THE AWESOME TEAM™保留所有权利2012< / div>
< / table>
< / body> ;
< / html>
;
$ message = $ v1 ;
$ headers = From:$ from \r\\\
;
$ headers 。= 内容类型:text / html\r\\\
;
邮件($ email,$ subject,$ message,$ headers);

$ count = count(文件( main_form.csv)) ;
$ today = date( d MY h:我是);
echo $ today ;



$ cvsData = \ n $ count $ today $ first_name $ last_name $ email $ telephone $ reason $ time $ comment ;

$ fp = fopen( main_form.csv a);
if($ fp){
fwrite($ fp,$ cvsData);
fclose($ fp);
}

?>

解决方案

first_name =


_POST [ first_name ];


last_name =


This is my contact form that I made. I am new to making contact forms and I am curious to know if I have done this correctly and if there are any errors within it that i should consider revising.

        <?php 
                  	$first_name = $_POST["first_name"];
                  	$last_name = $_POST["last_name"];
					$email = $_POST["email"];
					$telephone = $_POST["telephone"];
					$reason = $_POST["reason"];
					$time = $_POST["time"];
					$comment = $_POST["comment"];
					$to      = 'email@gmail.com';
					$subject = 'Parent Contact Form Submission';
					

 					$v1 = "
							<html> 
  							<body> 
							<style>
								h1 {color:#000066;}
						 		table {border:1px solid black; background: #e3f0ff;}
						 	</style>
						 	<h1>Hello, this form has been submitted!</h1>
						 	<img src= 'logo.png' />
						 	<table rules='all' style='border-color: #ffb300;' cellpadding='10' width='500px'>
							 	<tr style='background: #ffb300;'><td>First Name: </td>$first_name
							 	<tr style='background: #ffb300;'><td>Last Name: </td>$last_name
							 	<tr style='background: #fafafa;'><td>Email: </td>$email
							 	<tr style='background: #fafafa;'><td>Phone: </td>$telephone
							 	<tr style='background: #fafafa;'><td>Reason for Contact: </td>$reason
							 	<tr style='background: #fafafa;'><td>Best Time to Contact: </td>$time	 
							 	<tr style='background: #fafafa;'><td>Comments: </td>$comment
 							</table>   
  							</body> 
							</html> ";
					$message = $v1; 
    				$headers  = "From: $from\r\n"; 
    				$headers .= "Content-type: text/html\r\n"; 
    				mail($to, $subject, $message, $headers); 
    				echo "Message has been sent..."; //Page RE DIRECT 
//******************************************************************************************************************************//
                   
				    $first_name = $_POST["first_name"];
                  	$last_name = $_POST["last_name"];
					$email = $_POST["email"];
					$telephone = $_POST["telephone"];
					$reason = $_POST["reason"];
					$time = $_POST["time"];
					$comment = $_POST["comment"];
					$subject = 'Parent Contact Form Submission';
 					$v1 = "
							<html> 
  							<body> 
							<style>
								#disclosure {font-size: 8px; color: #333;}
								h1 {color:#000066;}
						 		table {border:1px solid black;}
						 	</style>
						 	<img src= 'logo.png' />
						 	<table rules='all' style='border-color: #ffb300;' cellpadding='10' width='500px'>
							 	<tr style='background: #ffb300;'><td>Email Confirmation
							 	<tr style='background: #fafafa;'><td>Hello  $first_name, your message has been recieved! We will contact you shortly! <br><br>Best, <br>Admin <br><br>Follow Us On:<br><a href='http://www.facebook.com'><img src='lfacebook_hover.png' width='18' height='18'></a><a href='http://twitter.com'><img src='twitter_hover.png' width='18' height='18'></a><a href='http://google.com'><img src='gplus_hover.png' width='18' height='18'></a><br><div id='disclosure' align='right'>©THE AWESOME TEAM™ All Rights Reserved 2012 </div>
 							</table>   
  							</body> 
							</html> ";
					$message = $v1; 
    				$headers  = "From: $from\r\n"; 
    				$headers .= "Content-type: text/html\r\n"; 
    				mail($email, $subject, $message, $headers);    
						
						$count= count(file("main_form.csv"));						
						$today = date("d M Y h:i A");
						echo $today;



$cvsData = "\n" . $count . "," . $today . "," . $first_name . "," . $last_name . "," . $email . "," . $telephone . "," . $reason . "," . $time . "," . $comment;

$fp = fopen("main_form.csv", "a" );
if($fp){
    fwrite($fp, $cvsData);
    fclose($fp);
    }					

?>

解决方案

first_name =


_POST["first_name"];


last_name =


这篇关于联系表格 - 我是否正确创建了这个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆