[SIZE=3]I have a PHP form which emails me all the fields to my email[/SIZE]
[SIZE=3]Text fields, radio button, option box and message fields works fine alone with attachment. But I only cannot get ALL checked values form checkboxes.[/SIZE]
[SIZE=3](When I select one checkbox, I get the result, but if I check, more than one, then I get only the last checkbox value)[/SIZE]
[SIZE=3]Need help[/SIZE]
[SIZE=3] [/SIZE]
[SIZE=3]My PHP Code is:[/SIZE]
<?php
$to = "[my real email]";
$subject = " PHP Mail FOrm Practice "; ;
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$system = $_REQUEST['system'] ;
$gender = $_REQUEST['gender'] ;
$language = $_REQUEST['language'] ;
$message = $_REQUEST['message'] ;
$url = "T6 - EGGI - Application for Job";
$details = "
URL - Form: $url
Subject: $subject
Name: $name
email: $email
system: $system
gender: $gender
language: $language
message: $message
";
ini_set("sendmail_from", $email);
// Obtain file upload vars
$fileatt = $_FILES['fileatt']['tmp_name'];
$fileatt_type = $_FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];
$headers = "From: $email";
if (is_uploaded_file($fileatt)) {
// Read the file to be attached ('rb' = read binary)
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
// Generate a boundary string
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Add the headers for a file attachment
$headers .= "
MIME-Version: 1.0
" .
"Content-Type: multipart/mixed;
" .
" boundary=\"{$mime_boundary}\"";
// Add a multipart boundary above the plain message
$message = "This is a multi-part message in MIME format.
" .
"--{$mime_boundary}
" .
"Content-Type: text/plain; charset=\"iso-8859-1\"
" .
"Content-Transfer-Encoding: 7bit
" .
$details . "
";
// Base64 encode the file data
$data = chunk_split(base64_encode($data));
// Add file attachment to the message
$message .= "--{$mime_boundary}
" .
"Content-Type: {$fileatt_type};
" .
" name=\"{$fileatt_name}\"
" .
//"Content-Disposition: attachment;
" .
//" filename=\"{$fileatt_name}\"
" .
"Content-Transfer-Encoding: base64
" .
$data . "
" .
"--{$mime_boundary}--
";
}
// Send the message
$ok = mail($to, $subject, $message, $headers);
if ($ok) {
echo "<p>Mail sent! Yay PHP!</p>";
} else {
echo "<p>Mail could not be sent. Sorry!</p>";
}
?>
[SIZE=3] [/SIZE]
[SIZE=3][/SIZE]
[SIZE=3]My HTML Code is:[/SIZE]
<html>
<body>
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<th scope="col"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th valign="top" bgcolor="#DDE8F7" scope="col"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th scope="col"><h1>Contact us form</h1>
<form action="contactus.php" method="post" enctype="multipart/form-data">
<br />
<table width="58%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="153" height="1" align="left" valign="middle">Full Name:</td>
<td width="333" align="left"><label for="name"></label>
<input type="text" name="name" id="name" /></td>
</tr>
<tr>
<td align="left" valign="middle">Persoanl Email:</td>
<td align="left"><input type="text" name="email" id="email" /></td>
</tr>
<tr>
<td width="153" height="2" align="left" valign="middle">Operating System</td>
<td align="left"><label for="system"></label>
<select name="system" id="system">
<option value="windows">Windows</option>
<option value="linux">Linux</option>
<option value="mobile">Mobile</option>
</select></td>
</tr>
<tr>
<td align="left" valign="middle">Gender</td>
<td align="left"><input type="radio" name="gender" value="Male" checked="checked">
Male
<input type="radio" name="gender" value="Female">
Female </td>
</tr>
<tr>
<td height="1" align="left" valign="middle">Languages:</td>
<td align="left">
<input type="checkbox" name="language" value="English"> English <br/>
<input type="checkbox" name="language" value="Pashto"> Pashto <br/>
<input type="checkbox" name="language" value="Dari"> Dari <br/> </td>
</tr>
<tr>
<td height="40" align="left" valign="middle">Message:</td>
<td align="left"><label for="message"></label>
<textarea name="message" id="message" cols="45" rows="5"></textarea></td>
</tr>
<tr>
<td height="40" align="left"> </td>
<td align="left"><label for="button"></label>
File Attachment:
<input type="file" name="fileatt" /> </tr>
<tr>
<td height="40" align="left"> </td>
<td align="left"><input type="submit" value="Send" /> </tr>
</table>
</form>
</th>
</tr>
</table></th>
</tr>
</table>
</th>
</tr>
</table>
</body>
</html>
[SIZE=3] thanks[/SIZE]