August 8th, 2012, 02:03 PM
PHP Mailer Sending files From Checkboxes
I'm trying to build a form for my website where users would go to the page, click checkboxes corresponding to various documents, and after entering their name and email address, they would be sent an email with the files attached, and I'd be emailed their information (or have the info go in a database).
Most files are relatively small and emailable, although I would also consider having the email just have links in the body of it that a user could click on to download the files if that is easier to do.
I've put together a basic form in Dreamweaver. What I need help with is finding/editing a php script to actually make the form functional and do what I'd like. From what I've read, it sounds like the phpmailer script is what I want, sending the data to my gmail account, but I'm confused on how to set it up with the functionality I want.
<p>Select Your Files...</p>
<form id="form1" name="form1" method="post" action="">
<input type="checkbox" name="DocumentA" id="DocumentA" />
<label for="DocumentA">Document A</label>
<input type="checkbox" name="DocumentB" id="DocumentB" />
<label for="DocumentB">Document B</label>
<input type="checkbox" name="DocumentC" id="DocumentC" />
<label for="DocumentC">Document C</label>
<input type="checkbox" name="DocumentD" id="DocumentD" />
<label for="DocumentD">Document D</label>
<input type="text" name="Name" id="Name" />
<input type="text" name="Email" id="Email" />
<input type="text" name="Comments" id="Comments" />
<input type="reset" name="Reset" id="Reset" value="Reset" />
<input type="submit" name="Reset" id="Reset" value="Submit" />
August 9th, 2012, 02:44 PM
Do things step by step
It's fairly complex to build a multipart MIME email with files attached. I don't know phpmailer; I assume it can do this for you but it would be far simpler to embed links in a plain text email. You wouldn't need anything more than the standard PHP mail() command. At least start that way and once you have it working you can always get more ambitious. (It's not clear from your post whether you've already tried this.)
Do things step by step. If you want to use phpmailer, start by doing the very minimum with it. Write a script that just sends a test message, then look into how to add attachments.