Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何向php联系人表单添加附件_Php_Html_Contact Form - Fatal编程技术网

如何向php联系人表单添加附件

如何向php联系人表单添加附件,php,html,contact-form,Php,Html,Contact Form,我制作了一个联系人表单,允许用户向我发送消息,但我不能添加的是他们向我发送文件的能力。这是我的密码: <form action="mail.php" method="post" enctype='multipart/form-data'> <input type="text" class="feedback-input" id="firstname" name="firstname" placeholder="First Name" size="30" required=

我制作了一个联系人表单,允许用户向我发送消息,但我不能添加的是他们向我发送文件的能力。这是我的密码:

<form action="mail.php" method="post" enctype='multipart/form-data'>

<input type="text" class="feedback-input" id="firstname" name="firstname"   placeholder="First Name" size="30" required="">
<br/>
<input type="text" class="feedback-input" id="lastname" name="lastname" placeholder="Last Name" size="30" required="">
<br/>
<input type="email" class="feedback-input" id="title" name="title" placeholder="E-mail" size="30" required="">
<br/>
<textarea name="message" class="feedback-input" placeholder="What can I help you with?" style="height: 150px;" required=""></textarea><br/>
<br/>

<input type="file" name="file" id="file" placeholder=" " tabindex="1" required/><br/>
<input type="submit" name="submit" id="Submit" value="Send">







这是mail.phph文件:

<?php
$firstname = $_POST['firstname'];
$title = $_POST['title'];
$lastname = $_POST['lastname'];
$message = $_POST['message'];
$ip = $_SERVER['REMOTE_ADDR'];
$formcontent=" From: $firstname $lastname \n Email Address: $title \n IP: $ip \n\n                    Description : $message";
$recipient = "myemail@yahoo.com";
$subject = "New Message!!";
$mailheader = "From: $title \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
header("Location: www.mythankyoupage.com");
die();
?>

使用PHP的
mail()
函数,很难找到类似的库