【问题标题】:php submission form using nl2br使用nl2br的php提交表单
【发布时间】:2015-03-17 10:15:37
【问题描述】:

我尝试制作一个表单,让访问者通过我的网站上传文件并将该文件发送到我的电子邮件。这是我的代码。但是,没有文件被上传并发送到我声明的电子邮件中。如果您能给我任何提示,我将不胜感激。

 <?php
 include('init.php');
$stitle="SUBMIT A MANUSCRIPT";
include ('head.php');

?>

 <link rel="stylesheet" type="text/css" href="view.css" media="all">
<script type="text/javascript" src="view.js"></script>

<table width="1100" align="center" style="border-bottom-right-radius:20px;"><td bgcolor="#ffffff">
<?php include ('nav.php'); 
if(!$_POST['title']) { ?>
<table cellspacing="4" width=100%><tr> <td bgcolor="eeeeee" width="100%" valign="top"><h3> Form</h3>

</td><td>
<body id="main_body" >


    <div id="form_container">

        <h1> Upload </h1>
        <form id="form_373615" class="appnitro" enctype="multipart/form-data" method="post" action="">

            <p>Please Complete all the boxes on this form.</p>
        </div>                      



< 
if ($_POST["email"]<>'') { 
    $ToEmail = '....'; 
    $EmailSubject = 'Site contact form'; 
    $mailheader = "From: ".$_POST["email"]."\r\n"; 
    $mailheader .= "Reply-To: ".$_POST["email"]."\r\n"; 
    $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
    $MESSAGE_BODY = "Name: ".$_POST["name"].""; 
    $MESSAGE_BODY .= "Email: ".$_POST["email"].""; 
    $MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"]).""; 
    mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); 
?> 


            <form action="test.php" method="post" enctype="multipart/form-data">
<table width="400" border="0" cellspacing="2" cellpadding="0">
<tr>
<td width="29%" class="bodytext">Your name:</td>
<td width="71%"><input name="name" type="text" id="name" size="32"></td>
</tr>
<tr>
<td class="bodytext">Email address:</td>
<td><input name="email" type="text" id="email" size="32"></td>
</tr>
<tr>
<td class="bodytext">Comment:</td>
<td><textarea name="comment" cols="45" rows="6" id="comment" class="bodytext"></textarea></td>

</tr>
<td width="29%" class="bodytext">Upload your file</td>
<td width="71%"><input type="file" name="uploaded_file"></td>

</tr>



<td align="left" valign="top"><input type="submit" name="Submit" value="Send"></td>


</p>



</tr>
</table>
</form> 

【问题讨论】:

标签: php forms submission


【解决方案1】:

首先将文件上传到服务器,然后将文件附加到邮件中。我希望this 对你有用。

【讨论】:

    猜你喜欢
    • 2019-10-18
    • 2018-04-03
    • 2012-01-10
    • 2013-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-19
    相关资源
    最近更新 更多