Of course it was something crazy easy! There is a missing else statement in my original code. It wasn't returning an error because there was no error. But I wasn't telling it what to do, either.
The culprit was if (file_exists($tmp_name)) {
Once I added a new else and code for an error page, no more blank page. Now it's just a matter of including error checking (other than file_exists) along the way. Here is the corrected code:
<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sumbit Your Resumé</title>
<link href="css/application.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/page.js"></script>
</head>
<body>
<?php if ($_SERVER['REQUEST_METHOD']=="POST"){
$namecap = strtoupper($_POST['fromname']);
$cover_letter = stripslashes($_POST['textarea']);
$today = date("j F Y");
$to="easmith@example.com";
$subject="Resumé";
$from = stripslashes($_POST['fromname'])." ".stripslashes($_POST['fromemail']).">";
$mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";
$tmp_name = $_FILES['filename']['tmp_name'];
$type = $_FILES['filename']['type'];
$name = $_FILES['filename']['name'];
$size = $_FILES['filename']['size'];
$message = "<h1>$fromname</h1> \n" .
"<h2>$telephone</h2> \n" .
"<p>Applying for: $position<br> \n" .
"Date Submited: $today<br> \n" .
"\n" .
"\n" .
"<pre>" . wordwrap($cover_letter,72) . "</pre>";
if (file_exists($tmp_name)) {
if(is_uploaded_file($tmp_name)) {
$file = fopen($tmp_name,'rb');
$data = fread($file,filesize($tmp_name));
fclose($file);
$data = chunk_split(base64_encode($data));
}
$headers = "From: $from\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: multipart/mixed;\r\n" .
" boundary=\"{$mime_boundary}\"";
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
$message .= "--{$mime_boundary}\n" .
"Content-Type: {$type};\n" .
" name=\"{$name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
if (@mail($to, $subject, $message, $headers)) {
echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td align='left' valign='top'> </td>
<td class='main'><h1>THANK YOU, $namecap</h1>
<p>Thank you for submitting your resumé. Your application will receive consideration without regard to race, creed, color, sex, age, national origin or disability. If you have no yet filled out an application, <a href='index.php'><strong>please click here.</strong></a></p>
</td>
<td valign='top'>
</td>
</tr>
</table>";
} else {
echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td align='left' valign='top'> </td>
<td class='main'><h1>ERROR</h1>
<p>I'm sorry, there was an error while attempting to submit your resumé. It may have been a simple server error. <a href='resume.php'><strong>Please click here to reattempt</strong></a>. If you continue to see this error, please call us at 1-800-788-5572.</strong></p>
</td>
<td valign='top'>
</td>
</tr>
</table>";
// Here is the offending section
else
echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td align='left' valign='top'> </td>
<td class='main'><h1>ERROR</h1>
<p>I'm sorry, there was an error while attempting to submit your resumé. It may have been a simple server error. <a href='resume.php'><strong>Please click here to reattempt</strong></a>. If you continue to see this error, please call us at 1-800-788-5572.</strong></p>
</td>
<td valign='top'>
</td>
</tr>
</table>";
// Which ends here
}
} else {
?>
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td valign='top'> </td>
<td class='main'><h1>SUBMIT YOUR RESUMÉ</h1>
<p><strong>Please Read Carefully:</strong> A cover letter is not required. You may submit your resumé as either a <strong>PDF</strong> or <strong>Microsoft Word</strong> file. The maximum allowable file size is <strong>2 megabytes.</strong> If you have not yet submitted an Employment Application, <a href="index.php">please click here</a>.</p>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" name="form1">
<fieldset id="personal_data">
<legend>Resumé</legend>
<ol>
<li>
<label for="name" class="textfield">Name: </label><input type="text" name="fromname" id="name" class="textfield" value="<?php echo $_SESSION['applicant'];?>"/>
<label for="position" class="textfield_r">Applying For: </label><input type="text" name="position" id="position" class="textfield" value="<?php echo $_SESSION['app_position'];?>"/>
</li>
<li>
<label for="telephone" class="textfield">Telephone: </label><input type="text" name="telephone" id="telephone" class="textfield" value="<?php echo $_SESSION['app_phone'];?>"/>
<label for="email" class="textfield_r">Email: </label><input type="text" name="fromemail" id="email" class="textfield" value="<?php echo $_SESSION['app_email'];?>"/>
</li>
<li>
<label class="textfield">Your resumé: </label><input type="file" name="filename" accept="application/pdf, application/msword, text, text/html" class="textfield" size="25">
</li>
</ol>
</fieldset>
<fieldset id="personal_data">
<legend>Cover Letter (optional)</legend>
<ol>
<li>
<textarea name="textarea" cols="35" rows="25" id="textarea"></textarea>
</li>
</ol>
</fieldset>
<div id="submit" class="centered"><input type="submit" name="submit" value="Submit My Resumé"/></div>
</form>
</td>
<td valign='top'> </td>
</tr>
</table>
<?php } ?>
</body>
</html>