我创建了一个表单,如果用户输入他们的详细信息并单击提交,则会将电子邮件发送到定义的电子邮件地址,我的问题是如何允许用户将文件添加到表单然后发送到已定义的电子邮件地址:
HTML:
<form>
名称
<p>
<input class = 'input-text' type = 'text' name = 'Number' placeholder = 'Number' required/>
<label>Number</label>
</p>
<p>
<input class = 'input-text' type = 'email' name = 'Email' placeholder = 'Email' required/>
<label>Email</label>
</p>
<p>
<input class = 'input-text' type = 'text' name = 'Company' placeholder = 'Company' required/>
<label>Company</label>
</p>
<p>
<input class = 'upload' type = 'file' name = 'File' placeholder = 'Please upload your business plan'>
<label>Upload a business plan </label>
</p>
<textarea type = 'text' placeholder = 'Any Comments?'></textarea>
<br />
<button class = 'send' value = 'submit' type = 'submit'>Send</button>
<button class = 'reset' value = 'reset' type = 'reset'>Reset</button>
</form>
PHP:
<?php
$name = $_POST['name'];
$number = $_POST['number'];
$email = $_POST['email'];
$company = $_POST['company'];
$comments = $_POST['comments'];
$to = "jackbryan49@msn.com";
$subject = "ADSML Contact Form";
$body = "This is an email from the ADMSL website, Please do not reply to this email. \n\n From: $name \n Contact Number: $number \n Contact Email: $email \n Company Name: $company \n User Comments: $comments";
mail ($to, $subject, $body);
header( 'Location: http://paulbryanpotatoes.com/ADMSL/Contact.html' ) ;
&GT;