Reply
Old 08-22-2009, 05:07 PM PHP Contact Form
Skilled Talker

Posts: 54
Trades: 0
Hey,

I have been using this code for probably over a year for contact forms and for some reason it is no longer working. I've tried it with two different hosting providers, and I'm still not receiving the emails. I'm not sure if I'm missing something small or not.

If someone could look over it for me that would be much appreciated, thank you!

Code:
My .php page:

<?php

if($_POST['name'] != "" & $_POST['email'] != "" & $_POST['phone'] != "" & $_POST['comments'] != ""){
    
$subject = "Inquiry";
$message .= "Name: {$_POST['name']} \n";
$message .= "Email: {$_POST['email']} \n";
$message .= "Phone: {$_POST['phone']} \n";
$message .= "Comments: {$_POST['comments']} \n";

$header="from: ".$_POST['name']." <".$mail_from.">";
$to ='my email address is usually here';

$send_contact=mail($to,$subject,$message,$header);
}

require_once('recaptchalib.php');
$privatekey = "key here";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
}

?>

Last edited by lilycup; 08-22-2009 at 06:43 PM..
lilycup is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 08-25-2009, 02:00 PM Re: PHP Contact Form
prasanthmj's Avatar
Average Talker

Posts: 27
Name: Prasanth
Trades: 0
Try putting an email address like name@websitename in the from field
Code:
$header="From: name@websitename.com";
where websitename is the website where you have this script. Many servers reject emails if 'From' is not provided
prasanthmj is offline
Reply With Quote
View Public Profile
 
Old 08-27-2009, 12:24 PM Re: PHP Contact Form
Average Talker

Posts: 21
Name: Rhowena MacCuish
Trades: 0
Hi I have the same problem. I tried following this advise. but it did not work for me. Have you had any luck with yours lilycup?
rhowbust is offline
Reply With Quote
View Public Profile
 
Old 08-27-2009, 11:39 PM Re: PHP Contact Form
Novice Talker

Posts: 6
Trades: 0
Oh. I was working on something like that and this fixed it. Thanks.
jasgor9 is offline
Reply With Quote
View Public Profile
 
Old 08-28-2009, 04:45 AM Re: PHP Contact Form
lizciz's Avatar
Ultra Talker

Posts: 330
Name: Mattias Nordahl
Location: Sweden
Trades: 0
I think the 'From' header should be like this to work properly

From: "Your Name" <your.name@domain.com>

So in php with variables it could be

PHP Code:
$header "From: \"$name\" <$email>";

// or...

$header 'From "' $name '" <' $email '>'
__________________
596f75206d65616e20796f752063616e2061637475616c6c79 207265616420746869733f

Last edited by lizciz; 08-28-2009 at 04:46 AM.. Reason: spelling error
lizciz is online now
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 08-28-2009, 05:48 PM Re: PHP Contact Form
Novice Talker

Posts: 3
Trades: 0
Hi,
I worked out on this problem.
Code seems to be correct.You can try by changing one of the field.
I think this will help you .Working on this and try to give the best solution.
Thanks.
snv123 is offline
Reply With Quote
View Public Profile
 
Old 08-29-2009, 03:32 PM Re: PHP Contact Form
Skilled Talker

Posts: 83
Trades: 0
If you can't find a solution then try using this contact form script (free). I've been using it for the past week and it works great:

http://www.642weather.com/weather/sc...ntact-form.php
Towhid is offline
Reply With Quote
View Public Profile
 
Old 09-03-2009, 01:36 AM Re: PHP Contact Form
Novice Talker

Posts: 6
Name: Upendra Duwadi
Trades: 0
If you send me the form, then I can create you script for free from a software and that is great.
upendraduwadi is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP Contact Form
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.12826 seconds with 13 queries