Amazon.com: PC Books || Educational Software || Magazines
Amazon: Books-CA || Software-CA || Books-UK || Software-UK

HTML | Javascript | ASP | PHP | VBScript | SQL | Hardware | PC FAQ| WinXP|

Learn to Build, Upgrade, or Repair your Computer Ebook + PC Safety 101 kwwebservice.com Reasonably priced web development & hosting
PHP Basics
Introduction
Variables & Arrays
Sub & Functions
If Statements
Case Statements
Loop Statements
Date Objects
Form Processing
Text File Objects
Database Access
Adding Record
Updating Record
Deleting Record
Virtual Includes
Cookies
Session
Server Variables
Creating Login Page
E-mail
PHP Books @
CA Amazon
UK Amazon
US Amazon

  :: Home
PC Topics
  :: Build A PC
  :: Windows XP
  :: PC Help
Tutorials
  :: HTML
  :: JavaScript
  :: ASP
  :: PHP
  :: VBScript
  :: SQL
Miscellaneous
  :: Code/Scripts
  :: Forum
  :: Links
  :: Contact us
  :: Tell A Friend
  :: In Somali
  ::
Web Articles
  Top Web Hosting
Reviews
  Processing
Online Card Payment Guide
  Domain name
registration & buying guide
  Getting
a website online guide
  Search Engine
submission & optimization tips
Netfirms Web Hosting
Free trial
Quality business correspondence.
Yahoo! Search Marketing


Send am Email with PHP Code

Code to send an E-mail utilizing html form and php. Save this code in a file named login.php, change the email to your own email and test it on your server.
<?php
$msg="";
$sent="";
if (isset($_POST['submit']))
{
  $name=$_POST['name'];
  $email=$_POST['email'];
  $message=$_POST['message'];
  $message=wordwrap($message, 70);
if (trim($name)=="" | trim($email)=="" | trim($message)=="")
{
  $msg= "<b><font color=red size=3>Required field is missing information. Please provide valid name, email and type your message. Inforamtion was not sent.</b></font><br>";
}
else
{
  $fro=$email;
  $to = "your_email@your_host.com";
  $subject = "Message From Your Site";
  $body = "Name: $name \nEmail: $email\n Message: $message";
}
if (mail($to,$subject,$body,"From:$fro\r"))
{
  $sent="Message was successfully delivery. You will be contacted at the email $email.";
}
else
{
  $msg=$msg."Message was NOT successfully delivery. Error: Delivery failed";
}
}
else
{
  $name="";
  $email="";
  $message="";
}
?>
<html>
<body>
<?php print "$msg <br> $sent"; ?>
<form name="form" method="post" enctype="multipart/form-data" action="login.php">
<table width="100%" border="1">
<caption>Contact Form</font>
<tr>
<td><font size="1" face="Verdana"><b>Name</b>:</font></td>
<td>
<?php
echo "<input type='text' name='name' value='$name' size='35' MaxLength='45'>";
?>
</td>
</tr>
<tr>
<td><font size="1" face="Verdana"><b>E-mail address</b>:</font></td>
<td>
<?php
echo "<input type='text' name='email' value='$email' size='35' MaxLength='45'>";
?>
</td>
</tr>
<tr>
<td><font face="Verdana"><b><font size="1">Message</font></b><font size="1">::</font></font></td>
<td>
<?php
echo "<textarea name='message' cols='45' rows='8'>$message</textarea>";
?>
</td>
</tr>
<tr>
<td colspan="2">
<p align="center"><font size="1" face="Verdana">
<input type="submit" name="submit" value=" Send ">
</td>
</tr>
</table>
</form>
</body>
</html>
Create login Page Home
Listed @ ConsumerVote.com - The Consumer Rated Web Directory
PC Articles
  Computer Safety
prevent viruses & Spyware