Question:
html help on my contact form!?
.
2012-07-10 19:48:49 UTC
Please I need some help, I'm building a website for a good friend and I need some help with the contact form. I found the code online but it's not working correctly. It sends the e-mail but not all the forms correctly, and doesn't send the picture. Also, when I send the form, it should link to the page contactus.html, but the link doesn't seem to work either. Can anyone help correct this code, this would help SO much. Thank you so, so much.
-------
Here is the HTML for the contact form:






















-------------------------------------------------------
And here is mail.php, which is supposed to help make the form work. I think here is where the problem is:

$address = $_POST['address'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$timeline = $_POST['timeline'];
$description = $_POST['description'];
$formcontent="From: $name \n Message: $message";
$recipient = "blanger@hawaii.edu";
$subject = "New Project Request from 2DadsDB.com";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!" . " -" . "Go Back";
?>
Five answers:
Gitlez
2012-07-10 21:13:31 UTC
There's a couple of issues with this.

1. You need to include in the form header that it will include files.

2. mail() needs some reworking to send files.

3. There needs to be some code to open and include the file.



Don't worry. Here is your code and html with needed changes and working fine. Although some error checking needs to be done for the uploads, this script simply assumes everything is ok, which is not normally a good thing to do.



Also the link won't work if the file isn't there. Remeber that it is written with a relative path.





contactus.html => http://pastebin.com/xBnjnTXZ

mail.php => http://pastebin.com/Tx3T6XFd





Follow up questions/concerns can be sent directly to me through: http://gitlez.comxa.com/contact.php



Cheers,

Gitlez
2012-07-11 08:05:06 UTC
So much easier:



Recommend using a server-side script language if your web site allows it. Otherwise, you will have to use a client-side dependent "mailto:" action to get the form info sent to you. Your current hosting package or service MUST allow SMTP ( http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol ) to work. Otherwise, no email can be sent.



Setting Up the SMTP Service: http://www.code-crafters.com/abilitymailserver1/tutorial_smtp.html



PHP: Sending Email Tutorial (Text/HTML/Attachments): http://www.webcheatsheet.com/php/send_email_text_html_attachment.php



Use any of the below sites to make the workable form you need (Just follow the instructions for making it and uploading file(s)):



Contact Form Generator: http://www.tele-pro.co.uk/scripts/contact_form/

WYSIWYG Form Maker (Easiest to Use): http://www.jotform.com/?gclid=CNKhqei1wJ4CFRQhnAod6laUqA

http://www.thesitewizard.com/wizards/feedbackform.shtml

http://www.form2email.net/

http://www.phpform.org/



Free Forms: http://www.jotform.com/form-templates/ Darn good forms already made!



http://www.thepcmanwebsite.com/form_mail.shtml



Ron
Napoleon
2012-07-12 23:50:09 UTC
I ended up using quickwebform. I just copied and pasted the code to my webpage. It comes with database and it's free. I hope this helps :)
2012-07-11 03:25:50 UTC
The reason why the link and the image doesn't work is cuz you have to tell php that yo are going to include images and link.



For that you have to include a couple of headers as foloows:



$mailheader .= 'MIME-Version: 1.0' . "\r\n";

$mailheader .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
Gohaleg
2012-07-11 02:50:54 UTC
I could help you with this but try stackoverflow. They have an answering system just for programming.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...