我有一个表格:
<form id='contactus' action='send.php' method='post' enctype="multipart/form-data" accept-charset='UTF-8'>
<fieldset>
<legend>My Form</legend>
<table><tbody>
<tr valign="top">
<td nowrap="nowrap" style="text-align: right;"><label for='name' >Name: </label></td>
<td><input type='text' name='name' id='name' value=''/></td></tr>
<tr valign="top">
<td nowrap="nowrap" style="text-align: right;"><label for='email' >Email: </label></td>
<td><input type='text' name='email' id='email' value=''/></td></tr>
<tr valign="top">
<td nowrap="nowrap" style="text-align: right;"><label for='link' >Link: </label></td>
<td><input type='text' name='link' id='link' value=''/></td></tr>
<tr valign="top">
<td nowrap="nowrap" style="text-align: right;"><label for='subject' >Subject: </label>
</td><td><input type='text' name='subject' id='subject' value=''/></td></tr>
<tr valign="top">
<td nowrap="nowrap" style="text-align: right;"><label for='description' >Description:
</label></td>
<td><textarea rows="10" cols="50" name='description' id='description'></textarea>
</td></tr>
<tr valign="top">
<td nowrap="nowrap" style="text-align: right;"><label for='photo' >Photo: </label></td>
<td><input type="file" name='photo' id='photo' /></td></tr>
</tbody></table>
<td nowrap="nowrap" style="text-align: center;"><input type='submit' value='Send' /></td>
</fieldset>
</form>
我的'send.php'是
<?php
if(isset($_POST['email'])) {
$email_to = "mymail@gmail.com";
$subject = $_POST['subject'];
$name = $_POST['name'];
$email = $_POST['email'];
$link = $_POST['link'];
$description = $_POST['description'];
$photo = $_POST['photo'];
$email_message .= "Name: ".($name)."\n";
$email_message .= "Email: ".($email)."\n";
$email_message .= "Link: ".($link)."\n";
$email_message .= "Subject: ".($subject)."\n";
$email_message .= "Description: ".($description)."\n";
$email_message .= "Photo: ".($photo)."\n";
// create email headers
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $subject, $email_message);
}
header("Location: thank-you.html");
?>
我的问题是:
1) 一切正常.. 除了“照片”,我知道它应该是附件。但是不知道怎么弄?
2)当我收到电子邮件时,我怎样才能看到这个粗体?
$email_message .= "名称: ".($name)."\n";
emp:姓名:约翰
我曾尝试这样做,但没有奏效。
$email_message .= "<b>Name: </b>".($name)."\n";
$email_message .= "<b>Email: </b>".($email)."\n";
$email_message .= "<b>Link: </b>".($link)."\n";
$email_message .= "<b>Subject: </b>".($subject)."\n";
$email_message .= "<b>Description: </b>".($description)."\n";
提前致谢