Hi all,
I have a problem in getting the files attached to my email form - when its submitted now do I only recieve the address to the file, and the actual file submitted.
Im using this form:
<form name="amateur" id="amateur" method="post" action="http://www.mysite.com/include/mail.php"
onSubmit="MM_validateForm('title','','R','name/nick','','R','email','','RisEmail');return document.MM_returnValue">
<table width="100%" border="0" cellspacing="10" cellpadding="10">
<tr>
<td align="center" valign="top" class="formtext"><table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="100" valign="top" class="formtext">Title</td>
<td class="formtext"><input name="title" type="text" id="title" size="30"></td>
</tr>
<tr>
<td valign="top" class="formtext">Your
name/nick</td>
<td class="formtext"><input name="name/nick" type="text" id="name/nick" size="30"></td>
</tr>
<tr>
<td valign="top" class="formtext">Your
email</td>
<td class="formtext"><input name="email" type="text" id="email" size="30"></td>
</tr>
<tr>
<td valign="top" class="formtext">Picture
#1</td>
<td class="formtext"><input name="pic#1" type="file" id="pic#1" size="30"></td>
</tr>
<tr>
<td valign="top" class="formtext">Picture
#2</td>
<td class="formtext"><input name="pic#2" type="file" id="pic#2" size="30"></td>
</tr>
<tr>
<td valign="top" class="formtext">Picture
#3</td>
<td class="formtext"><input name="pic#3" type="file" id="pic#3" size="30"></td>
</tr>
<tr>
<td valign="top" class="formtext">Picture
#4</td>
<td class="formtext"><input name="pic#4" type="file" id="pic#4" size="30"></td>
</tr>
<tr>
<td valign="top" class="formtext">Picture
#5</td>
<td class="formtext"><input name="pic#5" type="file" id="pic#5" size="30"></td>
</tr>
<tr>
<td valign="top" class="formtext">Picture
#6</td>
<td class="formtext"><input name="pic#6" type="file" id="pic#6" size="30"></td>
</tr>
<tr>
<td valign="top" class="formtext">Picture
#7</td>
<td class="formtext"><input name="pic#7" type="file" id="pic#7" size="30"></td>
</tr>
<tr>
<td valign="top" class="formtext">Picture
#8</td>
<td class="formtext"><input name="pic#8" type="file" id="pic#8" size="30"></td>
</tr>
<tr>
<td valign="top" class="formtext">Comment:</td>
<td class="formtext"><textarea name="comment" cols="37" rows="4" id="comment"></textarea></td>
</tr>
</table>
<br>
<table width="50%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="formtext"><input type="submit" name="Submit" value="Submit">
<input name="recipient" type="hidden" value="support@mysite.com" />
<input name="subject" type="hidden" value="Submitted photos" />
<input name="redirect" type="hidden" value="http://www.mysite.com/thx.htm" /></td>
<td align="right" class="formtext"><input name="clear" type="reset" id="clear" value="Clear"></td>
</tr>
</table>
</td>
</tr>
</table>
</form></td>
The include/mail.php looks like this:
<?php
if ($POST[recipient] && $POST[subject] && $_POST[redirect]) {
if ($POST[required]) {
$rfields = explode (",",$POST[required]);
foreach ($rfields as $check) {
if (!$POST[$check]) {
header("Location: ".$POST[errorpage]);
exit();
}
}
}
$ndata = array("recipient","subject","required","errorpage","redirect");
while (current($REQUEST)) {
if (!in_array(key($REQUEST),$ndata)) $msg .= key($REQUEST).": ".current($REQUEST)."\n";
next($_REQUEST);
}
mail($POST[recipient],$POST[subject],$msg,"From: $POST[email]\r\n"."Reply-To: $POST[email]\r\n");
header("Location: ".$_POST[redirect]);
}
else echo "Recipient, subject or redirect field is missing...";
?>
Whats missing?
I need the form to be able to include/attach up to 8 files (jpgs) and email to support@mysite.com
Sorry for the blurry code - I'm using Dreamweaver