Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP Form to Excel then send as email attachment
Old 09-28-2005, 10:32 AM PHP Form to Excel then send as email attachment
Junior Talker

Posts: 3
Trades: 0
Hi there,

I have a little situation. I am working on a form, basically, that grades people. Now, I got the form made, my outputs are ok. However, there is something I was my form to do, which I think is possible, but is a major road block for me.

Currently, my form does a POST in an Excel file, which is saved with the values that I want.

But I need this file to be send via email to recipient, CC to the user logged in and the part that I am confuse is to send the XLS file as attachment. Is that possible and if so, can someone guide me on how to get my outputted excel form in an attachment ready to send.

Thanks for your help.
Moloch is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-28-2005, 12:58 PM Your Form
Ultra Talker

Posts: 255
Location: NY
Trades: 0
Hi Moloch,
I've attached a zipped file for a formmail script. It will send out attachments to your email, a bcc, or cc email and include the attachment. I use it and it works great. You might want to try this easy solution.

By the way, how did you post the data into an excel file? I'd be very interested in how you did this.

Hope this helps,
DianeD

Last edited by DianeD; 04-05-2006 at 04:48 PM..
DianeD is offline
Reply With Quote
View Public Profile Visit DianeD's homepage!
 
Old 09-28-2005, 01:04 PM
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
So you can create the XLS file and just need to know how to send it? I Google'd this:

http://pear.php.net/package/Mail_Mime
http://www.4wordsystems.com/php_mail_attachment.php
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 09-28-2005, 01:20 PM
Junior Talker

Posts: 3
Trades: 0
Thanks for the reply.

Yes, I already have the output created, I use the header feature to load my POST data from my form to display it in Excel, however, it prompt's the user to either save it to HD or open it.

Code:
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition:filename=$agent-$userid.xls");
So basically, I am searching for something that might be able to send the newly created xls file, without having to save it on the server and simply mail it to the specified address .

thanks again, and in the mean time, I will check your post to see if I can do something with it.

cheers
Moloch is offline
Reply With Quote
View Public Profile
 
Old 09-28-2005, 01:34 PM
Extreme Talker

Posts: 169
Trades: 0
Use Php mime email class or phpmailer class

Phpmailer: download from sourceforge.net
phpmime: download from phpclasses.org

Both the classes comes with complete documentation and examples.
__________________

Please login or register to view this content. Registration is FREE

TOP 10 WEB HOSTS COMPARED

BEST RESELLER HOSTING
john551 is offline
Reply With Quote
View Public Profile
 
Old 09-28-2005, 02:54 PM
Junior Talker

Posts: 3
Trades: 0
Thank you all for your replies,

I've added more information to better help you or others to understand my situation. So here goes :-)


I am trying to create a grading sheet. Well, I've done it, it calculates and post my necesary information.

My problem is, I currently have setup to prompt the user to save or open the Excel .Xls file that it generates. However, I've been trying to search all over the place for my result, to send an email to a specific recipient with attached to output that it creates in Xls instead of saving the file.

In other words:

- fill out the form
- click submit
- then it sends email with the .xls file without prompting the user to save it or without storing it on the server(if possible)

I've tried to check out phpmail and the other links, however, I don't think will do the trick as I am not taking a file from the HD just the post data that's been converted to xls and send via email as attachment. If there is a way though with phpmail, can someone guide me on how to setup this particular feature.

if you want to see what it's currently doing, please visit http://moloch.ca/php/testing/form.html

Also, this is my code for the PHP file ( result.php ) if it may help:

Thanks for your help.
Brian

Code:
<?php
$agent = $_POST['agent'];
$salutation = $_POST['salutation'];
$transition = $_POST['transition'];
$loyalty = $_POST['loyalty'];
$solving = $_POST['solving'];
$rapport = $_POST['rapport'];
$footer = $_POST['footer'];
$resolution = $_POST['resolution'];
$userid = $_POST['userid'];
$lob = $_POST['lob'];
$internal = $_POST['internal'];
$procedures = $_POST['procedures'];
$spelling = $_POST['spelling'];
$grammar = $_POST['grammar'];
$punctuation = $_POST['punctuation'];
$msgcopier = $_POST['msgcopier'];
$bonus = $_POST['bonus'];
$today = date('d-M-y');
$notesq1 = $_POST['notesq1'];
$notesq2 = $_POST['notesq2'];
$notesq3 = $_POST['notesq3'];
$notesq4 = $_POST['notesq4'];
$notesq5 = $_POST['notesq5'];
$notesq6 = $_POST['notesq6'];
$notesq7 = $_POST['notesq7'];
$notesq8 = $_POST['notesq8'];
$notesq9 = $_POST['notesq9'];
$notesq10 = $_POST['notesq10'];
$notesq11 = $_POST['notesq11'];
$notesq12 = $_POST['notesq12'];

$total = $salutation + $transition + $loyalty + $solving + $rapport + $footer + $resolution + $internal + $procedures + $spelling + $grammar + $punctuation + $bonus ;


header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: filename=$agent-$userid.xls");



?>
<html>
<head><title>Grading Sheet Result</title>
</head>
<body>
<body>
<center>
<table border=1 width=1000>

<tr><td align=center bgcolor=blue colspan="4"><b><font color=yellow>CONTACT ASSESSMENT GRADING SHEET  RESULTS</font></b>
</td></tr>

<tr><td width=230><b>Name: </b></td><td width=150><?php echo $agent; ?></td>

<td width=120>
<b>Case</b>
</td>
<td><?php echo $userid; ?></td>
</td>

</tr>
<tr><td> Graded on </td><td><?php echo $today; ?></td>

<td>
<b>Business</b>
</td>
<td><?php echo $lob; ?></td>
</td>
</tr>

<tr height="50"><td align=top><b> Salutation (header): </b></td><td><b><center> <?php echo $salutation; ?></center></b></td>
<td colspan="2" align="top"> <div STYLE=" height: 50px; width:600px; overflow: auto;">
<b>Notes:</b> <?php echo $notesq1; ?></div>
</td>
</tr>

<tr height="50"><td><b> Transition: </b></td><td><b><center><?php echo $transition; ?></center></b></td>
<td colspan="2"> <div STYLE=" height: 50px; width: 600px; overflow: auto;">
<b>Notes:</b> <?php echo $notesq2; ?></div>
</td>
</tr>

<tr height="50"><td><b> Loyalty close (footer): </b></td><td><b><center><?php echo $footer; ?></center></b></td>
<td colspan="2"> <div STYLE=" height: 50px; width: 600px; overflow: auto;">
<b>Notes:</b> <?php echo $notesq3; ?></div>
</td>
</tr>

<tr height="50"><td><b> Delivery: </b></td><td><b><center><?php echo $delivery; ?></center></b></td>
<td colspan="2"> <div STYLE=" height: 50px; width: 600px; overflow: auto;">
<b>Notes:</b> <?php echo $notesq4; ?></div>
</td>
</tr>		

<tr height="50"><td><b> Rapport Building:  </b></td><td><b><center><?php echo $rapport; ?></center></b></td>
<td colspan="2"> <div STYLE=" height: 50px; width: 600px; overflow: auto;">
<b>Notes:</b> <?php echo $notesq5; ?></div>
</td>
</tr>		

<tr height="50"><td><b> Problem solving: </b></td><td><b><center><?php echo $solving; ?></center></b></td>
<td colspan="2"> <div STYLE=" height: 50px; width: 600px; overflow: auto;">
<b>Notes:</b> <?php echo $notesq6; ?></div>
</td>
</tr>

<tr height="50"><td><b> One contact Resolution: </b></td><td><b><center><?php echo $resolution; ?></center></b></td>
<td colspan="2"> <div STYLE=" height: 50px; width: 600px; overflow: auto;">
<b>Notes:</b> <?php echo $notesq7; ?></div>
</td>
</tr>

<tr height="50"><td><b> Internal policies and procedures: </b></td><td><b><center><?php echo $procedures; ?></center></b></td>
<td colspan="2"> <div STYLE=" height: 50px; width: 600px; overflow: auto;">
<b>Notes:</b> <?php echo $notesq8; ?></div>
</td>
</tr>

<tr height="50"><td><b> Revenue (bonus points): </b></td><td><b><center><?php echo $bonus; ?></center></b></td>
<td colspan="2"> <div STYLE=" height: 50px; width: 600px; overflow: auto;">
<b>Notes:</b> <?php echo $notesq9; ?></div>
</td>
</tr>

<tr height="50">
<td> <b>Spelling errors: </b></td><td><b><center><?php echo $spelling; ?></center></b></td>
<td colspan="2"> <div STYLE=" height: 50px; width: 600px; overflow: auto;">
<b>Notes:</b> <?php echo $notesq10; ?></div>
</td>
</tr>

<tr height="50">
<td> <b>Grammar: </b></td><td><b><center><?php echo $grammar; ?></center></b></td>
<td colspan="2"> <div STYLE=" height: 50px; width: 600px; overflow: auto;">
<b>Notes:</b> <?php echo $notesq11; ?></div>
</td>
</tr>

<tr height="50"><td><b> Punctuation: </b></td><td><b><center><?php echo $punctuation; ?></center></b></td>
<td colspan="2"> <div STYLE=" height: 50px; width: 600px; overflow: auto;">
<b>Notes:</b> <?php echo $notesq12; ?></div>
</td>
</tr>

<tr><td><b>Total: </b></td><td><b><center><font color="blue"><?php echo $total; ?></font> / 100</center></b></td>

</tr>

<tr>
<td colspan="4" witdh="1000">
<b>Copy of message:</b>  <?php echo $msgcopier; ?>
</td>

</tr>

</table>

</body></html>

<?php ?>
Moloch is offline
Reply With Quote
View Public Profile
 
Old 06-14-2007, 04:22 PM Re: PHP Form to Excel then send as email attachment
Junior Talker

Posts: 3
Name: Jesus Repetto
Trades: 0
Did sbdy manage to do this. I too am trying to do a similar thing. I can generate teh excel file but I don't know how to attach it to email since it is not saved on the server.
alltribz is offline
Reply With Quote
View Public Profile
 
Old 06-15-2007, 05:16 AM Re: PHP Form to Excel then send as email attachment
solomongaby's Avatar
Webmaster Talker

Latest Blog Post:
How Do You Find Music Online ?
Posts: 522
Name: Gabe Solomon
Location: Romania
Trades: 1
so why don't you save it in the temp folder ?
and after mail send delete it
__________________
If you like my posts ... TK is appreciated:)

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
solomongaby is offline
Reply With Quote
View Public Profile Visit solomongaby's homepage!
 
Old 06-15-2007, 05:23 AM Re: PHP Form to Excel then send as email attachment
Junior Talker

Posts: 3
Name: Jesus Repetto
Trades: 0
I was thinking of doing that but I don't know how to do that. ??? Can you tell me how ot do it?
alltribz is offline
Reply With Quote
View Public Profile
 
Old 06-15-2007, 05:27 AM Re: PHP Form to Excel then send as email attachment
solomongaby's Avatar
Webmaster Talker

Latest Blog Post:
How Do You Find Music Online ?
Posts: 522
Name: Gabe Solomon
Location: Romania
Trades: 1
a simple fopen,fwrite,fclose .... look those function on php.net
__________________
If you like my posts ... TK is appreciated:)

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
solomongaby is offline
Reply With Quote
View Public Profile Visit solomongaby's homepage!
 
Old 06-15-2007, 05:28 AM Re: PHP Form to Excel then send as email attachment
Junior Talker

Posts: 3
Name: Jesus Repetto
Trades: 0
thx will do
alltribz is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP Form to Excel then send as email attachment
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.32360 seconds with 12 queries