Comprehensive Feedback Form with Attachments
You know that spam harvesters are able to take e-mails from websites if they are just coded in standard HTML. You could encode your email as I’ve described earlier. But a feedback form is the best approach.
The most of feedback forms allow them to enter their name, email and type a message. Sometime you may need to send an attached file (a photo, a screenshot…).
This Feedback-Form script provides you with an option to send an attached file with the form message.
Download: feedback-form.zip
How to install this script
Note. PHP support at your hosting is required.
1) Download the feedback-form.zip file.
2) Unzip it with subdirectories at your local PC.

3) Open the config.php file ( 1 ) with an ASCII-text editor (i.e. Notepad)

4) Adjust this variables with appropriate values: $site_name ( 6 ) - the name of your site. It would be used inside the form title.
$support_email ( 7 ) - your email address to receive the form messages to.
You also can edit the $support_subject ( 8 ) and $support_message ( 9 ) variables to change the message Subject and Body.
5) Save the changed config.php file and upload all files with subdirectories onto your site.
6) Change the permissions of the tmp folder ( 2 ) to 777. (CHMOD 0777 tmp)
That’s all.
Place a link to feedback.php ( 3 ) on your site’s pages.
<a href="http://YouSite.com/feedback.php">Feedback</a>
If you’d like you can change the pages templates ( 5 ) with any HTML-editor. The template.form.html file is the template of the form-page. The template.thankyou.html file is the template of the thank-you page which appears after the form submitted.
Anti Form-Spam feature
(was added Jan 27, 2007)
The Anti Form-Spam feature is based on a JavaScript execution inside browsers.
Make sure you uploaded the md5.js ( 4 ) file beside your form-page template and set the $anti_bot variable ( 10 ) value to 1.
Related Articles:







September 7th, 2006 at 20:28
How can one use this feedback form with your HTML to PHP template system. I tried to incorporate this feedback form into my template system but I cant get it to work…it works fine as a standalone system but not with my template system which is based on your HTML to PHP template system.
September 8th, 2006 at 05:11
Hi Gann,
You can use your own web-form with the
feedback.phpscript.Create a html-page with your form. Set the
action-attribute of yourformwith thefeedback.phpscript.Then include the form-page like you’ve included the footer:
——————————
$FOOTER_FILE = "footer.html";
$FORM_FILE = "form.html";
…
// show the FORM
readfile($FORM_FILE);
// show the Footer
readfile($FOOTER_FILE);
exit;
——————————
Web-Form for the feedback.php
Your
form.htmlfile could look like this:<script type="text/javascript"><!--
function checkForm(theForm) {
if ("" == theForm.first_name.value) {
alert("Please enter your First name");
theForm.first_name.focus();
return false;
}
if ("" == theForm.email.value) {
alert("Please enter your Email");
theForm.email.focus();
return false;
}
return true;
}
//-->
</script>
<form action="feedback.php" method="post"
enctype="multipart/form-data"
onSubmit="return checkForm(this);">
<table width="500" align="center" border="0">
<tr>
<td>Feedback</td>
</tr>
<tr>
<td>
<table>
<tr>
<td><nobr><b>Your First Name</b></nobr></td>
<td><input name="first_name" /></td>
</tr>
<tr>
<td><nobr><b>Your Last Name</b></nobr></td>
<td><input name="last_name" /></td>
</tr>
<tr>
<td><nobr><b>Your Email address</b></nobr></td>
<td><input name="email" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%">
<tr valign="top"><td><b>Comment</b></td>
<td><textarea name="message" cols="40">
</textarea></td>
</tr>
<tr><td><b>Attachment</b></td>
<td><input type="file" name="file" /></td>
</tr>
<tr><td> </td>
<td><input type="submit"
value="Send Message" /></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
I hope this helps.
Michel
September 8th, 2006 at 05:57
awsome.
thanks michel,
September 14th, 2006 at 19:39
After using this method, I dont get the thankyou page after sending message.
September 17th, 2006 at 11:03
Hi Gann,
Did you uploaded the
template.thankyou.htmlfile with thefeedback.phpscript?Could you let me the link of your directory?
Michel
September 18th, 2006 at 16:47
Yes, I did upload the template.thankyou.html file. If I use the form example as shown here, I get the form again after sending email. But I also did notice the email was NOT sent.
Secondly, if I use the feedback.php directly for the form, it shows the code that is at the end of the code in the feedback.php file.
I could give you the link but I dont want to at this point because my site is not finished and I dont want any visitors to come to my site that might be reading this, until my site is ready. Can I send it privately to you in an email?
September 21st, 2006 at 17:57
First, I would like to thank you Michel for your help in trying to solve my previous problem. Much appreciated. I have a question concerning the line format of the received feedback email that is created using the feedback script. Where would I specify the line-format of the email that I receive using the feedback form. I want the emails to have a line format of about 65 characters wide…do I have to make a change inside the code of the feedback.php file? Thanks.
September 27th, 2006 at 15:45
Hi Jimmy,
I’ve uploaded new version of the Feedback script.
It allows you to format the message lines to 65 characters wide,
or whatever another wide.
You can set the lines-length with the “$wordwrap” config-variable:

I hope this helps.
Michel
PS. Please check your email-box.
I’ve sent the modified script to you.
September 27th, 2006 at 19:05
Thanks Michel. I am learning alot about PHP coding. You make it so simple to understand.
I have one last question that occured to me today…it concerns security. Does your feedback script contain a security feature that prevents others from using the feedback script installed on my site from another server? Spammers often use feedback forms on other servers to send spam.
Thanks,
Jimmy
September 28th, 2006 at 04:42
Hi Jimmy,
Yes! You’re right. I forgot about the forms vulnerability…
I’ve just added anti-spam security checking to the new version.
It prevents spam attacks through the
first_name,last_nameandemailfields.The new version is uploaded.
Michel
PS. The modified version has been sent to you.
November 21st, 2006 at 14:06
Hi Michel,
I really appreciate your code of feedback form that works pretty well. It seems that in the code you used ‘move_uploaded_file’ to uplaod attachment to the website, then attach it with email. Can email grabs attachment directly from user’s hard disk?
John
November 29th, 2006 at 18:49
Hi John,
Thanks for your question.
When a user submit a web-form with file-attachments their browser uploads the files onto the server (site). There isn’t any other way. Server can’t access to user’s hard disk.
The uploaded files are stored in the server temp folder. The script has to move or copy this files from the temp folder to be able to work with them.
This is why the ‘move_uploded_file’ PHP-function is used.
Michel
January 5th, 2007 at 14:10
I just installed your nifty feedback script…
… Assuming it’s not hacked by a spammer, it will top my list of the best feedback form I’ve tested (and I’ve tried a bunch).
I do have a request for you — it would be extremely helpful to add another field to automatically detect the HTTP Referer URI…
… For example, when someone writes something like:
I disagree with your opinion on the Iraq war — especially what you said in the second paragraph.
When this happens, I have to track down the feedback submitter and ask what webpage s/he’s referring to.
But by including the webpage URL, it saves me this step.
Even better, if your script could record other user information such as their browser software, IP address, screen size, operating system, and other easy to grab info, that would be helpful for helping troubleshoot problems with visitors to my site.
For example, if I saw this in my feedback:
Feedback:
I can’t see your website!
80.22.126.99
[80-22-126-99.dynamic.dsl.as9105.com]
United Kingdom
Internet Explorer
Agent String: Mozilla/4.0 (compatible; MSIE 4.0; Windows NT 2.1; SV1; .NET CLR 1.1.4322)
I’d be able to analyze the data and suggest this user upgrade their operating system and browser software. Plus, I’d also suggest removing the NET CLR spyware — a quite malicious one at that by the way.
Do you like? Can you add this to your next upgrade?
Once again, great job Michel.
Cheers,
Markus Allen
Publisher
http://www.marketing-ideas.org
January 5th, 2007 at 18:41
Hi Markus,
Thanks for your comment.
You can try new version with IP, Geo info and browser parameters included.
Download the new pack with the same link feedback-form.zip
I hope this helps.
Michel
July 9th, 2007 at 22:58
[…] For the “Ask A Question” form, you can get a free script right here. As I said, this is great to bulk up the content section of a website. I use both “Ask A Question” and “Submit A Topic” on one of my websites. It’s essentially the same thing, but it really bulks my site up well. […]
August 14th, 2007 at 16:41
Hy Michel,
I really appreciate your code of feedback form that I have installed in a webpage that I am going to lunch.
I have copied the code and pasted inside this page http://www.companiadelaselva.com/page06a.php?menu=6
I followed the instruccions of the config.php
then upload everything but
pasted the code of the template.form.html into this page
http://www.companiadelaselva.com/page06a.php?menu=6
and changed the form action to
It works pretty well I have tested but I have two questions Please :
1.- How do I fix the error message in red I have over the message box ?
2.- How do I make invisible the {FIRST_NAME} - {LAST_NAME} - {EMAIL}
tags that appear in the field Name - Last Name and email ?
Hope I didnot made a terrible mistake!
Thank you in advance
Fernanda Estrada
August 15th, 2007 at 10:13
Hi Fernanda,
1) Remove the
{ERROR}tag from the code you’ve copied into your http://www.companiadelaselva.com/page06a.php?menu=6 page.2) Also remove the
{FIRST_NAME} - {LAST_NAME} - {EMAIL}tags from the<input >fields.This should help.
Michel
September 3rd, 2007 at 14:17
Hi, is there a reason the file attached is limited to 1MB? Was hoping to raise this to more like 3-5MB
Thanks
September 3rd, 2007 at 14:25
Is it possible to send attatchments of over 1MB?
September 4th, 2007 at 04:58
Hi Paul,
Yes, it’s possible to send attachments of over 1MB.
There isn’t an attachment size limitation in the form-script itself.
However there is a size-limit in the PHP-settings for your hosting.
Generally the limit for a shared hosting is set to 2MB.
If you need more, you have to adjust your PHP-settings.
Michel
September 6th, 2007 at 00:09
Hi Michel,
I sometimes have people that wish to submit more than one file at a time (at most 3), and I don’t want them to have them have to resubmit the form for each file. Would it be a simple process to add 2 more of the file attachment controls? I’m very new to PHP, so I’m not sure how I’d go about doing this. Thanks.
Ps. Great site and exceptional help.
October 8th, 2007 at 12:13
Hi Michel
I’m trying to use my form (order.html) with yr feedback.php … I’ve follow all yr instructions above.. except below:
Then include the form-page like you’ve included the footer:
——————————
$FOOTER_FILE = “footer.html”;
$FORM_FILE = “form.html”;
…
// show the FORM
readfile($FORM_FILE);
// show the Footer
readfile($FOOTER_FILE);
exit;
——————————
Which file I’m supposed to include abv command? feedback.php or config.php?
This is the form i’m working on:
http://www.handmadeceramictiles.com/order.html
tks in advance…
kor
p/s:
May 6th, 2008 at 08:04
hello,
I am using this script , but I cant recieve any email into my support mail. When I submit the form, it says that the comments successfully submitted, but I cant recive any email.
if anyone knows, Please help me i need it urgently
July 27th, 2008 at 14:46
Hey Michel,
Great site. I certainly got more than I asked for when I Googled “oto scripts”.
I just downloaded your script on Feedback Forms with attatchments. I quickly set up a test page and everything works great.
Thanks a bunch,
Jeff