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 05-24-2008, 03:26 AM email question
aslanandbeez's Avatar
Experienced Talker

Posts: 39
Trades: 0
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
 
 
Register now for full access!
Old 05-24-2008, 10:00 AM Re: email question
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
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
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is online now
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 05-25-2008, 06:30 AM Re: email question
aslanandbeez's Avatar
Experienced Talker

Posts: 39
Trades: 0
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
Experienced Talker

Posts: 39
Trades: 0
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 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.48877 seconds with 12 queries