Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat can I add to this php email form to make it send attachments
    primarykey
    data
    text
    <p>I would like to make it so that I can attach the image specified in filefield "image" to the email that my form sends. What can I add here to do that? I appreciate the help. It should send me a message with the specified info and the image attachment if all goes well. </p> <pre><code>&lt;?php if ($_POST["email"]&lt;&gt;'') { $ToEmail = 'skidberna@yahoo.com'; $EmailSubject = 'Contact form from Legendmaker Customer: ' .$_POST["email"]; $mailheader = "From Legendmaker Customer: ".$_POST["name"]."\r\n"; $mailheader .= "Reply-To: ".$_POST["name"]."\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 .= "Recipient's Gender: ".nl2br($_POST["gender"])." "; $MESSAGE_BODY .= "Recipient's Name: ".$_POST["recipientname"]." "; $MESSAGE_BODY .= "Recipient's Hobbies/Interests: ".nl2br($_POST["hobbies"])." "; $MESSAGE_BODY .= "Recipient's Age: ".$_POST["age"]." "; $MESSAGE_BODY .= "Other Information: ".nl2br($_POST["otherinfo"])." "; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); ?&gt; &lt;title&gt;The Legend Maker - submit a story (test server)&lt;/title&gt; &lt;link href="/CSS/CSS.css" rel="stylesheet" type="text/css"&gt; &lt;div align="center"&gt; &lt;p&gt;&lt;span class="linkText"&gt;&lt;a href="/index.html"&gt;Home&lt;/a&gt; &lt;a href="/contact-us.php"&gt;Contact Us&lt;/a&gt; &lt;a href="/payments.html"&gt;Payments&lt;/a&gt; &lt;/span&gt; &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h2 class="headingText"&gt;&amp;nbsp;&lt;/h2&gt; &lt;h2 class="headingText"&gt;&amp;nbsp;&lt;/h2&gt; &lt;h2 class="headingText"&gt;&amp;nbsp;&lt;/h2&gt; &lt;h2 class="headingText"&gt;(for testing purposes)&lt;/h2&gt; &lt;h2 class="headingText"&gt;Submit a story test server&lt;/h2&gt; &lt;/div&gt; &lt;p&gt;Your story request was submitted &lt;?php } else { ?&gt; &lt;/p&gt; &lt;title&gt;The Legend Maker - submit a story (test server)&lt;/title&gt; &lt;link href="/CSS/CSS.css" rel="stylesheet" type="text/css"&gt; &lt;div align="center"&gt; &lt;p&gt;&lt;span class="linkText"&gt; &lt;a href="/index.html"&gt;Home&lt;/a&gt; &lt;a href="/contact-us.php"&gt;Contact Us&lt;/a&gt; &lt;a href="/payments.html"&gt;Payments&lt;/a&gt;&lt;/span&gt; &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h2 class="headingText"&gt;&amp;nbsp;&lt;/h2&gt; &lt;h2 class="headingText"&gt;&amp;nbsp;&lt;/h2&gt; &lt;h2 class="headingText"&gt;&amp;nbsp;&lt;/h2&gt; &lt;h2 class="headingText"&gt;(for testing purposes)&lt;/h2&gt; &lt;h2 class="headingText"&gt;Submit a story test server&lt;/h2&gt; &lt;/div&gt; &lt;form action="submit-story-with-attach.php" method="post" enctype="multipart/form-data"&gt; &lt;table width="476" height="468" border="0" cellpadding="0" cellspacing="2"&gt; &lt;tr&gt; &lt;td width="23%" height="25" class="bodytext"&gt;&lt;p align="center"&gt;Your Name:&lt;/p&gt;&lt;/td&gt; &lt;td width="77%"&gt;&lt;input name="name" type="text" id="name" size="32"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td height="25" class="bodytext"&gt;&lt;p align="center"&gt;Email Address:&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;input name="email" type="text" id="email" value="you@example.com" size="32"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td height="44" class="bodytext"&gt;&lt;p align="center"&gt;Recipient's Gender:&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;label&gt; &lt;select name="gender" id="gender"&gt; &lt;option value="male" selected="selected"&gt;Male&lt;/option&gt; &lt;option value="female"&gt;Female&lt;/option&gt; &lt;option value="other"&gt;Other&lt;/option&gt; &lt;/select&gt; &lt;/label&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td height="44" class="bodytext"&gt;&lt;p align="center"&gt;Recipient's Name:&lt;/p&gt; &lt;/td&gt; &lt;td align="left" valign="top"&gt;&lt;input name="recipientname" type="text" id="recipientname" value="ex: Jonny" size="32" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td height="44" class="bodytext"&gt;&lt;p align="center"&gt;Recipient's Interests or Hobbies: &lt;/p&gt;&lt;/td&gt; &lt;td align="left" valign="top"&gt;&lt;textarea name="hobbies" cols="50" rows="6" id="hobbies"&gt;ex: horseback riding, biking...&lt;/textarea&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="bodytext"&gt;&lt;p align="center"&gt;Recipient's Age:&lt;/p&gt;&lt;/td&gt; &lt;td align="left" valign="top"&gt;&lt;input name="age" type="text" id="age" size="5" maxlength="3" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="bodytext"&gt;&lt;p align="center"&gt;Other Important Information:&lt;/p&gt;&lt;/td&gt; &lt;td align="left" valign="top"&gt;&lt;textarea name="otherinfo" cols="50" rows="6" id="otherinfo"&gt;ex: other things the recipient may enjoy or their favorite superhero Please specify information you are giving us also: don't do this: superman submit it like this: favorite superhero: superman&lt;/textarea&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="bodytext"&gt;&lt;p align="center"&gt;Images You Would Like To Include In Story:&lt;/p&gt; &lt;/td&gt; &lt;td align="left" valign="top"&gt;&lt;label&gt; &lt;br /&gt; &lt;input type="file" name="image" id="image" /&gt; &lt;/label&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="bodytext"&gt;&lt;p align="center"&gt;&amp;nbsp;&lt;/p&gt;&lt;/td&gt; &lt;td align="left" valign="top"&gt;&lt;input type="submit" name="Submit" value="Send" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;?php }; ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload