Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 675151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:47:11+00:00 2026-05-14T00:47:11+00:00

Okay all, I have a form that I want users to fill out. When

  • 0

Okay all, I have a form that I want users to fill out. When They click submit, I want the contents of this form to be put into a message, and I want the contents to be added to an excel file. Then I want the message that is sent to the recipient to have an attachment of that excel file. You will see partial mime code, I have no Idea how to use it, that was my attempt at figuring this out… Heres what I have so far:

I guess the main question is more specifically, what in the code is making the contents the user submits, automatically go into an excel file and attach itself to the email?

$date = $_POST['date'];
$org =$_POST['Org'];
$activity =$_POST['activ'];
$dofevent = $_POST['dateoe'];
$money= $_POST['amountreq'];
$name =$_POST['name'];
$email =$_POST['email'];
$phone =$_POST['pnumber'];
$dateneeded =$_POST['datenb'];
//bottom
$semester =$_POST['semester'];
$question7a =$_POST['7a'];
$question7b =$_POST['7b'];



$mime_boundary = "<<<--==+X[".md5(time())."]";

$headers .= "From: SAF Request Form "; 
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed;\r\n";
//$headers .= " boundary=\"".$mime_boundary."\"";
$subject .="SAF Request Form";
//$message .= "This is a multi-part message in MIME format.\r\n";
//$message .= "\r\n";
//$message .= "--".$mime_boundary."\r\n";
//$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
//$message .= "Content-Transfer-Encoding: 7bit\r\n";

$message ="this is where I put my message";


mail ("20valvesofturbo@gmail.com",$subject,$message, $headers);



if( mail( "20valvesofturbo@gmail.com", $subject, $message, $headers ) ) {

echo "<p>The email was sent.</p>";

}

else {

echo "<p>There was an error sending the mail.</p>";

}





// start of xcel spreadsheet and header-->

$reg = "../data/eforms/saf/reg.xls";

$ft = fopen($reg,'a');
fwrite($ft,"header information");


// start of information submitted by user
fwrite($ft,  $org); 
fwrite($ft,"user submitted data");

fclose($ft);
//adds all the data



// individual excell sheet
$reg = "../data/eforms/saf/names/$org.xls";

$ft = fopen($reg,'w+');
fwrite($ft,"blablabla");
fclose($ft);



?>

what this does is it submits the data and sends a message, but it sends the data in an unknown file format as an attachment. If you open it in excel, it has the contents of the message…

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:47:12+00:00Added an answer on May 14, 2026 at 12:47 am

    For generating MIME encoded messages, I suggest that you use the Pear::Mail_Mime package ( http://pear.php.net/package/Mail_Mime). As for generating an Excel file, you can have a look at http://pear.php.net/package/Spreadsheet_Excel_Writer; depending on the complexity of the data to put into Excel, you could possibly also use just a CSV file

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, right now I have a form that contains this select list: <%=Html.LabelFor(x =>
Okay, so I have this CSV file of products and all the products have
okay, i have no idea why this isn't working at all. it seems like
Okay, I have looked hard for this answer, but all the websites, even the
Okay so I have a form that is using PHP to mail to an
I have a form that has a few select dropdowns, and I want to
I have this fsField is the class of all elements in the form. So
Okay I have a csv file that gets parsed and displayed. I want to
I have a large form that consists of all the input (text, checkbox, radio,
I have a simple form that I use to list the names of all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.