Web Design Forum  
 
Go Back   Web Design Forum > Web Software > Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 12-10-2011, 07:57 AM   #1
New Member
 
Join Date: Dec 2011
Posts: 15
Default PHP email form not working for some reason

I am using WAMP and everything works fine on it (including other PHP files). When I fill out the form properly, I do get redirected to the right page, which says:
"Your message was sent
Your message was successfully sent! Thank you for contacting us, we will reply to your inquiry as soon as possible!"

However, for some reason, I am not receiving an email after completing the form.

Here are the files I'm using:
contact.htm: http://pastebin.com/nE18nkWZ
contact.php: http://pastebin.com/yQv6uHWy
thanks.htm: http://pastebin.com/L2Ln3fB8b


The exact same problem occurs with this set of files:
contactform.htm: http://pastebin.com/ED4eqCZ9
send_form_email.php: http://pastebin.com/m6T5LKtv

I did fill out my email properly in the PHP files.

Thanks a lot for any help
Alex is offline   Reply With Quote


Old 12-10-2011, 09:28 AM   #2
Gold Member
 
Join Date: Feb 2011
Location: Australia
Posts: 369
Default

You can put this in your code to show if there are any PHP errors:

Code:
// Report all PHP errors
error_reporting(-1);
That should hopefully lead you in the right directly of why it's failing.



Then you can put in a redirect for a faulted attempted. Such as:

Code:
 
if(mail($myemail, $subject, $message)) {
/* Redirect visitor to the thank you page */
header('Location: thanks.htm');
exit();
} else {
/* Redirect visitor to the error page */
header('Location: failed.htm');
exit();
}
But if you are testing this on your local computer it may be failing because there isn't a mail server setup on your local machine for the mail() command to use. You can Google "PHP sendmail_from" and you should find ways to setup SMTP info in PHP.ini.

Hope that helps.
__________________
Jason H.
DHDdirect.com
Domains - Hosting - Design

Last edited by DHDdirect; 12-10-2011 at 09:42 AM.
DHDdirect is offline   Reply With Quote
Old 12-10-2011, 02:11 PM   #3
Silver Member
 
benjamin.morgan's Avatar
 
Join Date: Aug 2011
Posts: 187
Default

Okay. You are using WAMP a local server. To get it to work upload it to a live website. Problem should be solved
benjamin.morgan is offline   Reply With Quote
Old 12-10-2011, 07:43 PM   #4
New Member
 
Join Date: Dec 2011
Posts: 15
Default

Well turns out it does work on my website.. Thanks so much. and I'll remember the error reporting code too
Alex is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:36 AM.


Camera Forum - Computer Forum - Web Design Forum

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.