Reply
email question
Old 05-24-2008, 03:26 AM email question
aslanandbeez's Avatar
Average Talker

Posts: 17
Hey, I have cobbled together some code to store peoples detailsd and send me an email with said deteils, but I'm not getting the email so here's the code, what am I doing wrong? (I've left our the password for obvious reasons

<?php

$firstName = strip_tags(trim($_POST['first_name']));
$lastName = strip_tags(trim($_POST['last_name']));
$email = strip_tags(trim($_POST['Email']));
$message = strip_tags(trim($_POST['Message']));

$db_name="jonbak0_db";
$db_username="jonbak0_db";
$db_server="mysql4.freehostia.com";
$db_password="";

$sql = "INSERT INTO emailSignup (firstName,lastName,email,message) VALUES
('$firstName','$lastName','$email','$message')";
mysql_query($sql);

$to = "culturaldissection@hotmail.com";
$message = $_POST["Message"];
$messagesent = "From: $email Message: $message";
$from = $_POST["Email"];
$headers = "e-mail sign up from: $from";
mail($to,$messagesent,$headers);
echo "Your details have been sent, thank you.";
?>
__________________
Aslan & Beez Web Design - Today, Tomorrow, Forever
aslanandbeez is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 05-24-2008, 10:00 AM Re: email question
wayfarer07's Avatar
$frontend->developer

Posts: 1,046
Name: Abel Mohler
Location: Asheville, North Carolina USA
you have the wrong order in the mail function. The proper order is:
PHP Code:
mail($to$subject$message$headers); 
as you can see, you have the header where the message should be, and the message as part of a string where the subject should be.
Read this guide: http://us2.php.net/manual/en/function.mail.php
__________________
Go FREELANCE <=|If a donkey eats a melon, it is still a donkey... |=> Hire Me
wayfarer07 is online now
Reply With Quote
View Public Profile
 
Old 05-25-2008, 06:30 AM Re: email question
aslanandbeez's Avatar
Average Talker

Posts: 17
Hey thanks, it seems so obvious now that it has been pointed out!!!
__________________
Aslan & Beez Web Design - Today, Tomorrow, Forever
aslanandbeez is offline
Reply With Quote
View Public Profile
 
Old 05-25-2008, 11:48 AM Re: email question
aslanandbeez's Avatar
Average Talker

Posts: 17
I've tried that and it still doesn't seem to be working, I can't figure out what is wrong, here's the revised code;

<?php

$firstName = strip_tags(trim($_POST['first_name']));
$lastName = strip_tags(trim($_POST['last_name']));
$email = strip_tags(trim($_POST['Email']));
$message = strip_tags(trim($_POST['Message']));

$user="jonbak0_db";
$host="mysql4.freehostia.com";
$password="m1km1k";
$database ="jonbak0_db";

$connection= mysql_connect($host,$user,$password)
or die ("Couldn't connect to server");

$db = mysql_select_db($database,$connection)
or die ("Couldn't select database");

$query = "INSERT INTO emailSignup (firstName,lastName,email,subject,message) VALUES
('$firstName','$lastName','$email','$subject','$me ssage')";
$result = mysql_query($query)
or die ("Couldn't execute query");

$to = 'webmaster@jonathonbaker.com';
$from = $_POST['Email'];
$subject = $_POST['subject'];
$message = $_POST['Message'];
$headers = "e-mail sign up from: $from";
$mailsend = mail($to,$subject,$message,$headers);
echo "Your details have been sent, thank you.";
?>
__________________
Aslan & Beez Web Design - Today, Tomorrow, Forever
aslanandbeez is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to email question
 

Thread Tools

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

vB 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.13183 seconds with 12 queries