Admission Form Admission Form Full Name: Email Address: Phone Number: Select Course: CCC Tally Computer Basics Additional Message: Upload Photo: Submit New Admission Form Submission Name: $name Email: $email Phone: $phone Selected Course: $course Message: $message Attached Photo: $photo_name "; $headers = "From: $email\r\n"; $headers .= "Reply-To: $email\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; // Read the photo file $file_content = file_get_contents($photo_path); $encoded_file = chunk_split(base64_encode($file_content)); // Boundary for separating email content and file $boundary = md5(time()); // Email headers for attachment $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n"; // Email body with attachment $email_body = "--$boundary\r\n"; $email_body .= "Content-Type: text/html; charset=UTF-8\r\n"; $email_body .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $email_body .= $body . "\r\n\r\n"; $email_body .= "--$boundary\r\n"; $email_body .= "Content-Type: $photo[type]; name=\"$photo_name\"\r\n"; $email_body .= "Content-Disposition: attachment; filename=\"$photo_name\"\r\n"; $email_body .= "Content-Transfer-Encoding: base64\r\n\r\n"; $email_body .= $encoded_file . "\r\n\r\n"; $email_body .= "--$boundary--"; // Send the email with attachment if (mail($to, $subject, $email_body, $headers)) { echo "Thank you for your submission! We will contact you soon."; } else { echo "There was an error sending your form. Please try again later."; } // Clean up by deleting the uploaded file after email is sent unlink($photo_path); } else { echo "Only JPEG, JPG, and PNG images are allowed."; } } else { echo "The photo is too large. Maximum size is 2MB."; } } else { echo "There was an error uploading the photo."; } } else { echo "Invalid request."; } ?>