| | |
Simple Email Form
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2005
Posts: 7
Reputation:
Solved Threads: 0
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.
•
•
Join Date: May 2005
Posts: 9
Reputation:
Solved Threads: 0
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.
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.
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
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
•
•
Join Date: May 2005
Posts: 2
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by zippee
mail($sendto,$subject,$body)
PHP Syntax (Toggle Plain Text)
mail("literature-request@mysite.com","Form Submitted at your website",$message,"From: phpFormGenerator");
PHP Syntax (Toggle Plain Text)
mail("literature-request@mysite.com,backup-account@altsite.com","Form Submitted at your website",$message,"From: phpFormGenerator");
--don
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);
// 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);
Ecommerce-Web-Store.com Building Your e-Business.
![]() |
Similar Threads
- Simple Email Form in ASP.Net (ASP.NET)
- Is it possible to create an "Email a Friend" or and email form... (ASP)
- Please help with email form script (PHP)
- Need help with this email form (Java)
Other Threads in the PHP Forum
- Previous Thread: Need help with directory displayer code
- Next Thread: adding a database to my webpage
| Thread Tools | Search this Thread |
5.2.10 action apache api array beginner binary broken cakephp checkbox class classes cms code cron curl database date destroy display dynamic echo echo$_get[x]changingitintovariable... email encode error fcc file files folder form forms function functions google header howtowriteathesis href htaccess html if-else image images include insert ip javascript joomla limit link local login mail memberships menu mlm mod_rewrite multiple multipletables mysql mysqlquery neutrality oop open passwords paypal pdf php provider query radio random record remote rss script search server sessions sockets source space sql strip_tags syntax system table template thesishelp tutorial update upload url validator variable video voteup web window.onbeforeunload=closeme; youtube





