File Upload is working and Display of Uploaded files is working on confirmation page. Email of results has all the text field info but only the 2nd file info not the 1st file info in it.
I must be missing something in the file aray loop for email results. Please help 😕
HTML Form:
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="5">
<tr align="left" valign="top">
<td><form action="modules.php?name=Submissions&file=sent" enctype="multipart/form-data" method="POST">
<p>
<input name="Your_Name" type="text" id="Your_Name" size="30">
<font size="2" face="Tahoma"><strong>Your Name</strong></font><strong></strong><br>
<br>
<select size="1" name="Department">
<option selected>Choose Department From List</option>
<option>Branch Administration</option>
<option>Call Center</option>
<option>CD's/IRA's</option>
<option>Collections</option>
<option>Commercial Lending</option>
<option>Commercial Loan Documentation</option>
<option>Community Investment Center</option>
<option>Coopersburg Office</option>
<option>Country Square Office</option>
<option>Credit</option>
<option>Deposit Services</option>
<option>Downtown Office</option>
<option>Dublin Village Office</option>
<option>Electronic Banking</option>
<option>Executive Administration</option>
<option>Finance</option>
<option>Human Resources</option>
<option>Information Technology</option>
<option>Loan Services</option>
<option>Mailroom</option>
<option>Marketing</option>
<option>Operations</option>
<option>Pennsburg Office</option>
<option>Perkasie Office</option>
<option>Quakertown Commons Office</option>
<option>Retail Lending</option>
<option>Security</option>
<option>Souderton Office</option>
<option>Trust</option>
<option>Town Bank Center 1st Floor</option>
<option>Town Bank Center 2nd Floor</option>
<option>Town Bank Center 3rd Floor</option>
</select>
<font size="2" face="Tahoma"><strong>Department</strong></font></p>
<p>
<input name="Phone" type="text" id="website3" size="30">
<font size="2" face="Tahoma"><strong>Phone</strong></font><br>
<br>
<br>
<strong><font size="2" face="Tahoma">Change Needed</font></strong><br>
<textarea name="Request" cols="75" rows="10" wrap="VIRTUAL" id="Request"></textarea>
<br>
<br>
<strong><font size="2" face="Tahoma">Associated Files:</font></strong><br>
<input name="file2upload" type="file" size="30">
</p>
<p>
<input name="file2upload2" type="file" size="30">
<br>
<br>
<input name="submit" type="submit" value="Submit">
<strong><font size="4" face="Arial, Helvetica, sans-serif">*</font><font size="3" face="Arial, Helvetica, sans-serif">
<font size="2">Indicates Required</font></font></strong></p>
</form></td>
</tr>
</table>
PHP Form Handler:
<?php
$file_dir = "modules/Submissions/files/";
echo " <b>Thank You ".$Your_Name.", You submitted the following:</b><br><br>";
print "<b>Name:</b> ".$Your_Name."<br>\n";
print "<b>Phone:</b> ".$Phone."<br>\n";
print "<b>Department:</b> ".$Department."<p>\n";
print "<b>Change Needed:</b><br> ".$Request."<p><p>\n";
print "-------------Attached Files-------------<br>\n";
foreach($_FILES as $file_name => $file_array) {
print "<b>File:</b> <a href=\"modules/Submissions/files/".$file_array['name']."\" target=\"_blank\">".$file_array['name']."</a><br><b>Type: </b>".$file_array['type']."<br><b>Size: </b>".$file_array['size']." Bytes<p>\n";
if (is_uploaded_file($file_array['tmp_name'])) {
move_uploaded_file($file_array['tmp_name'], "$file_dir/$file_array[name]") or die ("Error Couldn't Upload File");
}
}
$To = "Me@Email.com";
$Subject = "Intranet Submission";
$Info = "Name: $Your_Name
Phone: $Phone
Department: $Department
Change Needed: $Request";
foreach($_FILES as $file_name => $file_array) {
$Files = "
File Name: ".$file_array['name']."
File Type: ".$file_array['type']."
File Size: ".$file_array['size']." Bytes";
}
if($Info != "")
{
mail($To, $Subject, $Info, $Files);
}
else
{
print("<HTML><BODY><Center><B>ERROR</B><Br>There was an error while Proccessing this form, Please call the IT helpline at X5111<BR>The information was NOT sent .");
print("</center></BODY></HTML>");
}
?>