Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

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

Posts: 58
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
 
 
Register now for full access!
Old 08-25-2009, 02:00 PM Re: PHP Contact Form
prasanthmj's Avatar
Experienced Talker

Posts: 42
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
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
prasanthmj is offline
Reply With Quote
View Public Profile
 
Old 08-27-2009, 12:24 PM Re: PHP Contact Form
Average Talker

Posts: 28
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
Webmaster Talker

Posts: 744
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 '>'
__________________
34343639363436653237373432303635373837303635363337 34323037343638363137343263323036343639363432303739 366637353366

Last edited by lizciz; 08-28-2009 at 04:46 AM.. Reason: spelling error
lizciz is offline
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.
__________________

Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
snv123 is offline
Reply With Quote
View Public Profile
 
Old 08-29-2009, 03:32 PM Re: PHP Contact Form
Super Talker

Posts: 101
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.25939 seconds with 12 queries