PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
elitefreke
Forum Newbie
Posts: 3 Joined: Wed Sep 10, 2003 2:26 am
Post
by elitefreke » Wed Sep 10, 2003 2:26 am
Greetings. I am kinda new to the PHP lanquage and I just wrote a script for my site where users may submit a form via email. It seems to work when "Submit" is pressed, but I am not recieving the email! Please help!
the form link is:
http://www.midnightracing.org/joinapp.html
the script for the php file is:
Code: Select all
<?php
//create short variable names
$name=$_POSTї'name'];
$location=$_POSTї'location'];
$email=$_POSTї'email'];
$age=$_POSTї'age'];
$sex=$_POSTї'sex'];
$year=$_POSTї'year'];
$make=$_POSTї'make'];
$model=$_POSTї'model'];
$currentmods=$_POSTї'currentmods'];
$futuremods=$_POSTї'futuremods'];
$toaddress = 'webmaster@midnightracing.org';
$subject = 'New Membership Request';
$mailcontent = 'Name: '.$name."\n"
.'Age: '.$age."\n"
.'Email: '.$email."\n"
.'Sex: '.$sex."\n"
."Vehicle Info: \n"
.'Year: '.$year."\n"
.'Make: '.$make."\n"
.'Model: '.$model."\n"
.'Current Mods: '.$currentmods."\n"
.'Future Mods: '.$futuremods."\n";
$fromaddress = 'From: webserver@example.com';
mail ($totaladdress, $mailcontent, $fromaddress);
?>
<html>
<head>
<title>Feedback Submitted</title>
</head>
<body>
<center>
<h1>Feedback Submitted</h1>
<p>Your info has been sent!</p>
</center>
</body>
</html>
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Wed Sep 10, 2003 2:57 am
shouldn't this line
Code: Select all
mail ($totaladdress, $mailcontent, $fromaddress);
be
Code: Select all
mail ($toaddress, $mailcontent, $fromaddress);
Mark
m3rajk
DevNet Resident
Posts: 1191 Joined: Mon Jun 02, 2003 3:37 pm
Post
by m3rajk » Wed Sep 10, 2003 8:46 am
no. mail must have a (set of) to address(es)
then a subject
then the content
optional is other headers, such as a from address.
you have no subject, so your to addresses are getting an e-mail of a truncated message and your from address
so it should be mail($toaddress, $subject, $content, $from);
Last edited by
m3rajk on Wed Sep 10, 2003 8:20 pm, edited 1 time in total.
JAM
DevNet Resident
Posts: 2101 Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:
Post
by JAM » Wed Sep 10, 2003 10:53 am
He means:
You are using these two lines in your script:
Code: Select all
$toaddress = 'webmaster@midnightracing.org';
// ...
mail ($totaladdress, $mailcontent, $fromaddress);
Are you seeing the difference?
elitefreke
Forum Newbie
Posts: 3 Joined: Wed Sep 10, 2003 2:26 am
Post
by elitefreke » Wed Sep 10, 2003 3:33 pm
yep... i see what i did. thanks for the help!
m3rajk
DevNet Resident
Posts: 1191 Joined: Mon Jun 02, 2003 3:37 pm
Post
by m3rajk » Wed Sep 10, 2003 8:21 pm
JAM wrote: He means:
You are using these two lines in your script:
Code: Select all
$toaddress = 'webmaster@midnightracing.org';
// ...
mail ($totaladdress, $mailcontent, $fromaddress);
Are you seeing the difference?
thanx. i got sidetracked with my mother's complaining about something as i wrote that.