Hi,
I've done up a simple page. problem is when i submit form, if there's no attachment, I'll receive the drag down items. But when i have drag down items and attachment, i only receive attachment.
Please help to see what's wrong with code. Thanks.
<form action="../r2_form.php" name="form2" method="post" enctype="multipart/form-data">
<select name="Availability" class="style10">
<option value="" selected>---------- Please Select Job ----------</option>
<option value="Immediate">Immediate</option>
<option value="1 Week">1 Week</option>
<option value="2 Week">2 Week</option>
<option value="3 Week">3 Week</option>
<option value="1 Month">1 Month</option>
<option value="6 Week">6 Week</option>
<option value="2 Week">2 Month</option>
<option value="3 Month">3 Month</option>
</select>
</span></textarea>
</span></td>
</tr>
<tr class="style10">
<td colspan="2" align="center"><span class="style54"><strong><span class="style49">Attach Resume</span><img src="images/spacer.gif" width="15" height="1"> </strong></span>
<input type="file" name="attachment" /></td>
</tr>
<tr class="style10">
<td colspan="2" align="center"><span class="style48">
<input type="submit" value="Upload Resume or Data">
</span></td>
</tr>
<tr class="style10">
<td colspan="2" align="center"> </td>
</tr>
</table>
</form>
Action file...... r2_form.php
<?
$admin = ("look4edmund@gmail.com");
$sitename = ("gmail.com");
$FName = $POST['FName'];
$LName = $POST['LName'];
$Availability = $_POST['Availability'];
$submissiondate = date("D dS M, Y h:i a");
$filename= "counter.txt" ; // Numbers the submissions of the form
$fd = fopen ($filename , "r") or die ("Can't open $filename") ;
$fstring = fread ($fd , filesize ($filename)) ;
fclose($fd) ;
$fd = fopen ($filename , "w") or die ("Can't open $filename") ;
$fcounted = $fstring + 1 ;
$fout = fwrite ($fd , $fcounted ) ;
fclose($fd) ;
$subject = "$sitename Submission No. $fcounted\n";
$mail_boundary = "x".md5(time())."x";
$header = "From: $name <$email>\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: multipart/mixed; boundary=\"{$mail_boundary}\"\r\n";
$header .= "X-Priority: 3\r\n";
$header .= "X-MSMail-Priority: Normal\r\n";
$header .= "X-Mailer: aMAILzing 0.9 [url]http://scripts.inexistent.org\r\n[/url]";
$header .= "This is a multi-part message in MIME format.\r\n\r\n";
$header .= "--{$mail_boundary}\r\n";
$header .= "Content-type: text/plain; charset=\"iso-8859-1\"\r\n";
$header .= "Date: ".date(R)."\r\n";
$header .= "Content-Transfer-Encoding:7bit\r\n\r\n";
$header .= $message."\r\n\r\n";
$msg .= "----- Website Submission -----\n\n";
$msg .= "Date/Time Submitted: $submissiondate - EST\n";
$msg .= "Name: $FName $LName\n";
$msg .= "Submission ID: $fcounted\n\n";
$msg .= "Availability: $Availability \n\n";
$msg .= "Message:\n\n";
// Attach the uploaded files, if there is any.
if($_FILES){
if (get_magic_quotes_runtime() == 1){
set_magic_quotes_runtime(0);
}
foreach($_FILES as $key=>$value){
foreach($value as $key2 => $value2){
$$key2 = $value2;
}
if (is_uploaded_file($tmp_name)) {
$fp = fopen($tmp_name,'rb');
$read = fread($fp,$size);
fclose($fp);
$file = base64_encode($read);
$file = chunk_split($file);
$header .= "--$mail_boundary\r\n";
$header .= "Content-type: $type; name=\"$name\"\r\n";
$header .= "Content-Transfer-Encoding:base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"$name\"\r\n\r\n";
$header .= $file."\r\n\r\n";
}
}
}
$to = "$admin";
mail($to, $subject, $msg, $header, $mailheaders);
?>