944,153 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 10180
  • PHP RSS
May 27th, 2005
0

Simple Email Form

Expand Post »
Can someone please help me. I just want to put a simple form on my web site. I am using dreamweaver and first of all, I am NOT a techy. I basically taught myself Dreamweaver and created my own e-commerce site. I would like to have a form for people to sign up for a newsletter. All I want them to fill in is NAME and EMAIL ADDRESS. I paid someone to build be a Contact Us Page. I just cant believe it is that hard to do. I just feel like there is one step that I am missing. I am pretty computer literate but I am not a programmer. I would appreciate any help you can give me. I am sure someone has a simple basic form out there that they would share. Thanks.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pamwynne is offline Offline
7 posts
since May 2005
May 29th, 2005
0

Re: Simple Email Form

What exactly do you want the form to do?

Would you like it to just send you an email with their name and email? If so, this is an easy PHP project. :cheesy:
Reputation Points: 10
Solved Threads: 0
Newbie Poster
PatrickE is offline Offline
9 posts
since May 2005
May 31st, 2005
0

Re: Simple Email Form

Yes, all I want the form to do is to send me an email with their name and email address.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pamwynne is offline Offline
7 posts
since May 2005
May 31st, 2005
0

Re: Simple Email Form

Try this:

On your form, have the field for their name called "name".
The field for their email should be called "email".

Now, below is the PHP code for the page you submit the form to.
[php]<?php
$email=$_POST['email'];
$name=$_POST['name'];
$subject = "New Mailing List Signup";
$sendto = "your@email.addy";
$body = "This is the information filled out for their signup. /n /n Name: $name /n Email: $email /n /n This signup was generated by your server."
mail($sendto,$subject,$message)
?>[/php]

You can customize it however you want. And for your understanding, the "/n" means line break.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
PatrickE is offline Offline
9 posts
since May 2005
May 31st, 2005
0

Re: Simple Email Form

Error found in script provided by PatrickE. This last line should be:

mail($sendto,$subject,$body)

You can also add header information:

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "To: ".$name." <".$email.">\r\n";
$headers .= "From: Someone <someone@somedomain.com>\r\n";
$headers .= "Cc: cykong@store2go.net\r\n";
$headers .= "Bcc: bcc@store2go.net\r\n";

mail($sendto, $subject, $body, $headers);


zippee
--------------------------
www.basket2go.net
www.store2go.net
Reputation Points: 10
Solved Threads: 7
Posting Whiz in Training
zippee is offline Offline
294 posts
since Jan 2005
Jun 7th, 2005
0

Re: Simple Email Form

Thanks. I will give this a try.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pamwynne is offline Offline
7 posts
since May 2005
Jun 8th, 2005
0

Re: Simple Email Form

Quote originally posted by zippee ...
mail($sendto,$subject,$body)
This is what I have working now:

PHP Syntax (Toggle Plain Text)
  1. mail("literature-request@mysite.com","Form Submitted at your website",$message,"From: phpFormGenerator");
How do I make it send the messge to multiple addresses? Does the following do it?
PHP Syntax (Toggle Plain Text)
  1. mail("literature-request@mysite.com,backup-account@altsite.com","Form Submitted at your website",$message,"From: phpFormGenerator");
thanks!

--don
Reputation Points: 10
Solved Threads: 0
Newbie Poster
darnoldy is offline Offline
2 posts
since May 2005
Jun 9th, 2005
0

Re: Simple Email Form

Your code will work. It would be easy to see by breaking down the code

// get data
$email = $_POST["email"];

// use comma to separate email address
$to = "user1@domain.net" . ", ";
$to .= $email . ", " ;
$to .= "user3@domain.net" ;

// finally,
mail($to, $subject, $message);
Reputation Points: 10
Solved Threads: 7
Posting Whiz in Training
zippee is offline Offline
294 posts
since Jan 2005
Jun 9th, 2005
0

Re: Simple Email Form

Quote originally posted by zippee ...
Your code will work.
thanks!

--don
Reputation Points: 10
Solved Threads: 0
Newbie Poster
darnoldy is offline Offline
2 posts
since May 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Need help with directory displayer code
Next Thread in PHP Forum Timeline: adding a database to my webpage





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC