Current location: Hot Scripts Forums » Programming Languages » PHP » submit email form


submit email form

Reply
  #1 (permalink)  
Old 02-12-06, 01:03 PM
drogue drogue is offline
New Member
 
Join Date: Feb 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
submit email form

hi - i have a simple form that allows users to input their email and submit - how do I call the PHP - or get the form to send to my email account I have set up - This has got to be an easy PHP document - ? But I cannot find anything that helps! I am in Dreamweaver - do I create a seperate PHP file that the form calls after clicking "submt" - or it it embedded in the HTML?

confused!

thanks for any help - mark
Reply With Quote
  #2 (permalink)  
Old 02-12-06, 01:17 PM
Barnz1986 Barnz1986 is offline
Aspiring Coder
 
Join Date: Jan 2006
Posts: 506
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by drogue
hi - i have a simple form that allows users to input their email and submit - how do I call the PHP - or get the form to send to my email account I have set up - This has got to be an easy PHP document - ? But I cannot find anything that helps! I am in Dreamweaver - do I create a seperate PHP file that the form calls after clicking "submt" - or it it embedded in the HTML?

confused!

thanks for any help - mark
You create a serperate PHP file and then you link to it using the forms action.

e.g. <form action="yourscript.php" method="POST">

Also make sure you include the method="POST".
Reply With Quote
  #3 (permalink)  
Old 02-12-06, 03:23 PM
HoTDaWg's Avatar
HoTDaWg HoTDaWg is offline
Newbie Coder
 
Join Date: Aug 2005
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
hey dude,

I found like the best PHP contact form ever. It is so customizable that I am currently using it to make a user authentication script. Here is the script:

Code:
<?php
$form_block = "
<form method=\"post\" action=\"$PHP_SELF\">
<p><strong>Your name:</strong><br>
<input type=\"text\" name=\"name\" size=30 value=\"$_POST[name]\"</p>
<p><strong>Your email:</strong><br>
<input type=\"text\" name=\"email\" value=\"$_POST[email]\"size=30</p>
<p><strong>Comments:</strong><br>
<textarea name=\"comments\" cols=30 rows=5 wrap=virtual>$_POST[comments]</textarea></p>
<input type=\"hidden\" name=\"op\" value=\"ds\">
<p><input type=\"submit\" name=\"submit\" value=\"Send Form\"></p><br>
</form>";

if ($_POST[op] != "ds") {
echo "$form_block";

} else if ($_POST[op] =="ds") {

if ($_POST[name] == "") {
	$name_err = "<font color=blue>Please enter your name!</font><br>";
	$send="no";
}
if ($_POST[email] == "") {
	$email_err = "<font color=blue>Please enter your email!</font><br>";
	$send="no";
}
if ($_POST[comments] == "") {
	$message_err = "<font color=blue>Please enter a comment!</font><br>";
	$send="no";
}
if ($send !="no") {
$msg = "Email Sent From example.com/\n";
$msg .="Name: $_POST[name]\n";
$msg .="Email: $_POST[email]\n";
$msg .="Comments: $_POST[comments]\n";
$to = "YOUR EMAIL HERE";
$subject = "Feedback Form";
$mailheaders = "From: http://www.example.com/<admin@mydomain.com>\n";
$mailheaders .= "Reply-To: $_POST[email]\n";
mail ($to, $subject, $msg, $mailheaders);
	echo "<p>Your email has been sent!</p>";

} else if ($send == "no") {
	echo "$name_err";
	echo "$email_err";
	echo "$message_err";
	echo "$form_block";
     }

}
?>
Hope this helps!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
submit application form by email martin_ua ASP.NET 3 12-21-05 10:11 AM
submit from form 1 to form 3 bypassing form 2 buzzby PHP 1 06-01-05 02:06 PM
form to anyone's email with Image Verification ghostrider632 PHP 1 05-11-05 09:08 AM
Email after Form 'submit' sixflagsga Script Requests 1 10-09-04 11:04 PM


All times are GMT -5. The time now is 06:33 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.