quick php q
- Started
- Last post
- 8 Responses
- stewart
i've made an online form where the text from all the input fields is collected and sent as an formatted email.
i now want to change that and collect all the text from the input fields and send it as an .txt attachment.
this is the php code i now use to send the text (along with an attached image) to an emailaddress:
http://www.kulsdom.com/newstoday…
- neverblink0
if (!$handle = fopen($filename, 'w')) {
print "Cannot open file ($filename)";
exit;
}// Write $somecontent to our opened file.
if (!fwrite($handle, $somecontent)) {
print "Cannot write to file ($filename)";
exit;
}fclose($handle);
- UndoUndo0
you want to know how to add the attachment to the email?
- stewart0
well undo,
i need to know how to put the input text in a .txt documentand after that the .txt document has to be attached to the email.
(for your information: it has to fit in the existing code:
http://www.kulsdom.com/newstoday… )
- UndoUndo0
try that, there might be minor errors as pastebin is hard to read
- neverblink0
sorry I read the first post too fast.. anyway..
here's an explanation of how to do it..
- UndoUndo0
you ought to also check out sanitisation of the posted elements. a dodgy bot would have a field day with that script
- stewart0
still no luck...
- acescence0
where is the failure exactly? i would separate out the steps involved and get them working individually first