|
-
Jul 24th, 2006, 05:55 PM
#1
Thread Starter
Frenzied Member
Contact Form
Help Please
I'm trying to get this to work what i need it to do is show the username thats been typed in the contact form to show in the body of the message with the comments. I have only added the $user at the top still needs to be put in the bottom half
can anyone help me please.
PHP Code:
<?
$name = $_POST['name'];
$email = $_POST['email'];
$user = $_POST['user'];
$comment = $_POST['comment'];
if ($name != ""){
if ($comment != ""){
if ($email != ""){
mail( "[email protected]", "Feedback From $name",
"$comment", "From: $email" );
$feedback = "Comment Sent.";
} else {
$feedback = "You have left one or more of the fields empty. Please go <a href=\"signup.html\">back</a> and make sure you enter information in every field.";
}
} else {
$feedback = "You have left one or more of the fields empty. Please go <a href=\"signup.html\">back</a> and make sure you enter information in every field.";
}
} else {
$feedback = "You have left one or more of the fields empty. Please go <a href=\"signup.html\">back</a> and make sure you enter information in every field.";
}
?>
<? echo "$feedback"; ?>
Last edited by Jamie_Garland; Jul 24th, 2006 at 06:04 PM.
-
Jul 24th, 2006, 06:33 PM
#2
<?="Moderator"?>
Re: Contact Form
try this
PHP Code:
$comment = $_POST['user'] . "\n\r" . $_POST['comment'];
You don't need the double quotes around the $comment in the mail function, its not needed.
-
Jul 24th, 2006, 07:03 PM
#3
Thread Starter
Frenzied Member
Re: Contact Form
Where abouts in the code does this go
-
Jul 24th, 2006, 07:11 PM
#4
<?="Moderator"?>
Re: Contact Form
replace
PHP Code:
$comment = $_POST['comment'];
with
PHP Code:
$comment = $_POST['user'] . "\n\r" . $_POST['comment'];
also check out the comments on http://uk.php.net/mail there is some good examples and is worth reading if you want to expand your code to send HTML emails.
-
Jul 24th, 2006, 07:12 PM
#5
Thread Starter
Frenzied Member
-
Jul 24th, 2006, 07:27 PM
#6
Thread Starter
Frenzied Member
Re: Contact Form
Im looking for a script like the one below.
http://www.goodealhosting.com/signup.php
-
Jul 25th, 2006, 02:24 AM
#7
Re: Contact Form
 Originally Posted by Jamie_Garland
Where abouts in the code does this go
You said the body of the message? What meesge? John has shown you how to append the username to a string. If you are unable to work out how to append it to another string, I suggest you quit now.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|