mail() + filled in form as attachment

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bytte
Forum Commoner
Posts: 75
Joined: Sun Nov 23, 2003 8:20 am
Location: Belgium

mail() + filled in form as attachment

Post by bytte »

I have a page with a form.
The layout of the form is very important to have a good overview.

When clicking submit, I want to email the form through the mail() function. Now, that's not a problem to do of course. But the tricky part is that I want the filled in form to be sent as an attachment with the email.

The reason for that is that the layout remains the same in the attachment and the people the mail is sent to, can easily print the form and see the filled in form properly (no plain text).

Can this be done through PHP? Any help appreciated!
bytte
Forum Commoner
Posts: 75
Joined: Sun Nov 23, 2003 8:20 am
Location: Belgium

Post by bytte »

anyone? please!
sunilbhatia
Forum Newbie
Posts: 2
Joined: Tue Feb 10, 2004 1:14 am
Location: India

Post by sunilbhatia »

Hi,

What you can do is to create the form and store in the variable like this

$msg = "<form action=post method='http://URL/formprocessor.php'>
......
</form>";

And then mail it to the address you want to like this

@mail($toemail,"Subject Line",$msg,"Content-Type: text/html\r\nFrom: Your Name <your@email.com>\r\n");

The user will get to see the same form in his client, which when he fills the data will be made available to your URL in the action attribute of the form

Hope this helps

Thanks
Sunil
Post Reply