Re: Simple email form
| From: | David VanHorn | Date: | Mon, 31 Jul 2000 21:22:51 +0000 |
| Subject: | Re: Simple email form | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-9282@lists.php.net to get a copy of this message | ||
At 01:18 PM 7/31/00 -0500, Mike Tuller wrote:
<?include ('/home/dvanhorn/PHP/do_random_cookie.php') ?> <HTML> <? include("../headmeta.inc")?> <TITLE>SpamWhack Member Services - User Feedback</TITLE></HEAD> <? include("../header.inc")?> <FORM ACTION="Feedback2.php" METHOD="POST" NAME="Feedback" ENCTYPE="x-www-form-urlencoded"> <HR> <CENTER> <FONT color=#AA0000> <H2>Please enter your feedback below.</H2></FONT><BR> Your contact information is automatically included in the email from your account records, so you don't need to enter that unless you want us to use some other address/phone/email/method to reach you. </CENTER> <HR> <P><TEXTAREA NAME="feedback" ROWS="10" COLS="70"></TEXTAREA> <P><INPUT NAME="Enter" TYPE="submit" VALUE="Submit"> <INPUT NAME="name" TYPE="reset" VALUE="Reset this form"> </BLOCKQUOTE> <? include("../footer.inc")?> </HTML> <?include ('/home/dvanhorn/PHP/do_random_cookie.php') ?> <HTML> <? include("../headmeta.inc")?> <TITLE>SpamWhack Member Services - User Feedback</TITLE></HEAD> <? include("../header.inc"); $Debug = false; # !!! I took out all the database stuff, it confuses the issue. # By the time you get here, you should have a row, containing the user's data # Pull the active field from the row If ($Debug) {echo ("Parsing data from ISP_Rules<br>");} # End of if while ($Row = mysql_fetch_object($Result)) { # $Reference = $Row->reference; $Contact_Name = $Row->contact_name; $Contact_CO_Name = $Row->contact_co_name; $Contact_Email = $Row->contact_email; $Contact_Phone = $Row->contact_phone; } #VERY helpful! If ($Debug) {echo ("Account =".$reference."<br>");}; # End of if If ($Debug) {echo ("Contact Name =".$Contact_Name."<br>");}; # End of if If ($Debug) {echo ("Company Name =".$Contact_CO_Name."<br>");}; # End of if If ($Debug) {echo ("Email =".$Contact_Email."<br>");}; # End of if If ($Debug) {echo ("Phone =".$Contact_Phone."<br>");}; # End of if # Take out slashes from the mail body $feedback = stripslashes($feedback); #Establish email addresses and fields $F_Email = "dvanhorn@cedar.net"; $Subject = trim("This is the subject.\n"); $From = "From: ".$Contact_Name." ".$Contact_Email."\n"; $Reply_To = "Reply-to: ".$Contact_Email."\n"; $Headers = ($From.$Reply_To); #Again, very helpful! if ($Debug) {echo ("To: ".$F_Email."<BR>". $From."<BR>". $Reply_To."<BR>". $Subject."<BR>". $Mailer."<BR>". $Errors."<BR>". #$Priority."<BR>". "Message :<BR>". $feedback."<HR>");} #Here's where the mailing happens! $F_Error = mail ($F_Email, $Subject, $feedback, $Headers); if ($Debug) {echo ("F_Error =".$R_Error."<BR>");} # Tell the user they will be contacted shortly echo ("Your feedback has been sent.<hr>"); echo ("</TABLE>"); ?> <? include("../footer.inc")?> </HTML>
I'm wanting to create a simple email form, and I've looked on PHPBuilder and other sites, and either the examples will not work correctly, or they are overly complex. What is the easiest way to create a simple email form?I can't believe nobody answered this one yet! Here's both sides of one that I'm using.. Rename the second one to feedback2, and do what you have to do to fill in the variables. Taking the text from a form, the " get turned into /", so you have to use stripslashes to get rid of them. Where I use this is registered user feedback. My cookie system tells me who is requesting, so I pull up the data from Mysql, and fill out the fields for them. You could put more fields in the form, and let them type in addresses, but then you risk them using your form to mailbomb some schmuck somewhere.. Holler if you need more help. It's such a JOY when this works.. My system emails me if it encounters problems, tells me what happened, and I can go right there and fix it. So far, only used it once, and that was an induced error to test the system, but it's a great comfort knowing it's there.
<?include ('/home/dvanhorn/PHP/do_random_cookie.php') ?> <HTML> <? include("../headmeta.inc")?> <TITLE>SpamWhack Member Services - User Feedback</TITLE></HEAD> <? include("../header.inc")?> <FORM ACTION="Feedback2.php" METHOD="POST" NAME="Feedback" ENCTYPE="x-www-form-urlencoded"> <HR> <CENTER> <FONT color=#AA0000> <H2>Please enter your feedback below.</H2></FONT><BR> Your contact information is automatically included in the email from your account records, so you don't need to enter that unless you want us to use some other address/phone/email/method to reach you. </CENTER> <HR> <P><TEXTAREA NAME="feedback" ROWS="10" COLS="70"></TEXTAREA> <P><INPUT NAME="Enter" TYPE="submit" VALUE="Submit"> <INPUT NAME="name" TYPE="reset" VALUE="Reset this form"> </BLOCKQUOTE> <? include("../footer.inc")?> </HTML> <?include ('/home/dvanhorn/PHP/do_random_cookie.php') ?> <HTML> <? include("../headmeta.inc")?> <TITLE>SpamWhack Member Services - User Feedback</TITLE></HEAD> <? include("../header.inc"); $Debug = false; # !!! I took out all the database stuff, it confuses the issue. # By the time you get here, you should have a row, containing the user's data # Pull the active field from the row If ($Debug) {echo ("Parsing data from ISP_Rules<br>");} # End of if while ($Row = mysql_fetch_object($Result)) { # $Reference = $Row->reference; $Contact_Name = $Row->contact_name; $Contact_CO_Name = $Row->contact_co_name; $Contact_Email = $Row->contact_email; $Contact_Phone = $Row->contact_phone; } #VERY helpful! If ($Debug) {echo ("Account =".$reference."<br>");}; # End of if If ($Debug) {echo ("Contact Name =".$Contact_Name."<br>");}; # End of if If ($Debug) {echo ("Company Name =".$Contact_CO_Name."<br>");}; # End of if If ($Debug) {echo ("Email =".$Contact_Email."<br>");}; # End of if If ($Debug) {echo ("Phone =".$Contact_Phone."<br>");}; # End of if # Take out slashes from the mail body $feedback = stripslashes($feedback); #Establish email addresses and fields $F_Email = "dvanhorn@cedar.net"; $Subject = trim("This is the subject.\n"); $From = "From: ".$Contact_Name." ".$Contact_Email."\n"; $Reply_To = "Reply-to: ".$Contact_Email."\n"; $Headers = ($From.$Reply_To); #Again, very helpful! if ($Debug) {echo ("To: ".$F_Email."<BR>". $From."<BR>". $Reply_To."<BR>". $Subject."<BR>". $Mailer."<BR>". $Errors."<BR>". #$Priority."<BR>". "Message :<BR>". $feedback."<HR>");} #Here's where the mailing happens! $F_Error = mail ($F_Email, $Subject, $feedback, $Headers); if ($Debug) {echo ("F_Error =".$R_Error."<BR>");} # Tell the user they will be contacted shortly echo ("Your feedback has been sent.<hr>"); echo ("</TABLE>"); ?> <? include("../footer.inc")?> </HTML>