Username: Save?
Password:
Home Forum Links Search Login Register*
    News: Welcome to the TechnoWorldInc! Community!
Recent Updates
[April 24, 2024, 11:48:22 AM]

[April 24, 2024, 11:48:22 AM]

[April 24, 2024, 11:48:22 AM]

[April 24, 2024, 11:48:22 AM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[February 14, 2024, 02:00:39 PM]
Subscriptions
Get Latest Tech Updates For Free!
Resources
   Travelikers
   Funistan
   PrettyGalz
   Techlap
   FreeThemes
   Videsta
   Glamistan
   BachatMela
   GlamGalz
   Techzug
   Vidsage
   Funzug
   WorldHostInc
   Funfani
   FilmyMama
   Uploaded.Tech
   MegaPixelShop
   Netens
   Funotic
   FreeJobsInc
   FilesPark
Participate in the fastest growing Technical Encyclopedia! This website is 100% Free. Please register or login using the login box above if you have already registered. You will need to be logged in to reply, make new topics and to access all the areas. Registration is free! Click Here To Register.
+ Techno World Inc - The Best Technical Encyclopedia Online! » Forum » THE TECHNO CLUB [ TECHNOWORLDINC.COM ] » Programming Zone » PHP
  PHP Form Mail Script
Pages: [1]   Go Down
  Print  
Author Topic: PHP Form Mail Script  (Read 2059 times)
Daniel Franklin
TWI Hero
**********


Karma: 3
Offline Offline

Posts: 16647


View Profile Email
PHP Form Mail Script
« Posted: September 26, 2007, 11:46:07 AM »


$date = date ("m/d/Y");

This line configures the date, I enjoy using this and putting it somewhere in the processor, mainly the subject, so I know what date the comments were sent in on. This can be configured many different ways.

$name=$_POST['name']; $email=$_POST['email']; $comments=$_POST['comments'];

These three statements are how you get the information from the HTML form into this PHP processor. This takes from the POST method the HTML form and assigns the output into variables that we can use to produce the output. These output variables can differ depending on the info that your forms provide.

$to="[email protected]"; $subject="The subject for your email"; /* IE: Comments on $date */ $message="Comments from $name\n\nName: $name\nE-mail: $email\nComments: $comments"; $from="$email"; $headers="From: $email\n";

This is all the information to actually output the information. $to is the email address that you wish to send the comments to. $subject is the subject of the email that gets sent. $message is the formatted message that will be the body of the message with the variables, Note: \n skips 1 line. $from is the email address it's coming from, which isn't necessarily needed. $headers creates the headers for the email message, you should make it good attempt to do so, as some mail servers won't accept the mail without headers.

if (mail($to,$subject,$message,$headers)) { echo "
Thank you for sending your comments
"; } else { echo "There was a problem sending mail, this is a coding issue"; }

This is the piece of code that actually sends the email. PHP has a very simple command to send mail it's mail($to,$subject,$message,$headers); and is very self explanatory, as it mails using those variables. The if statement allows coding error control. If the email address entered isn't correct, or something is missing, it will post an error.

That concludes this PHP form mail tutorial. Please visit http://justincanada.net for more Smiley. Thanks.

Articles Source - Free Articles

Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Copyright © 2006-2023 TechnoWorldInc.com. All Rights Reserved. Privacy Policy | Disclaimer
Page created in 0.131 seconds with 24 queries.