This is a test post

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Webnews
  • MisterWong
  • Y!GG
  • Google Bookmarks
  • Technorati

We are offering web design and programming services. Check out our profile on Elance at http://thewebhostcompany.elance.com

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Webnews
  • MisterWong
  • Y!GG
  • Google Bookmarks
  • Technorati

PHP mail forms are very easy to create. This brief tutorial and code sample, will get you going.

It uses templates to format the body of the email that will be sent, and supports plain text and HTML formatted messages.

The first step is to create a simple HTML web page to take the form input. Here is a simple example:

<HTML>
<HEAD>
<TITLE>PHP mail form</TITLE>
</HEAD>
<BODY>
<FORM METHOD="POST" ACTION="mailform.php">
<P>First Name: <INPUT TYPE="TEXT" NAME=”firstname”></P>
<P>First Name: <INPUT TYPE=”TEXT” NAME=”lastname”></P>
<P>Email: <INPUT TYPE=”TEXT” NAME=”from_email”></P>
<P>Message:</P>
<TEXTAREA NAME=”message”></TEXTAREA>
<P><INPUT TYPE=”submit” NAME=”submit” VALUE=”submit”></P>
</FORM>
</BODY>
</HTML>

The second step is to create your template files. The first file is just plain text. Take the INPUT name attributes (see above in bold), and place them in your template file enclosed in square brackets. For example [firstname] wherever you would like these to appear in the body of your message.

Form Input:
[firstname]
[lastname]
[email]
[subject]
[message]

Then create an HTML formatted template in the same way. Use HTML markup to format the body of the message as shown below:

<HTML>
<BODY>
<P>[firstname]</P> 
<P>[lastname]</P> 
<P>[from_email]</P> 
<P>[message]</P>
</BODY>
</HTML> 

Next, you will need to create another HTML page to display confirmation that the form has been submitted. An example is shown below:

<HTML>
<HEAD>
<TITLE>PHP mail form: Thank you page</TITLE>
</HEAD>
<BODY>
<P>Thank you. Your message has been sent</P>
</BODY>
</HTML>

Finally, the script that makes it all work. Make sure you change the user defined values at the top of the script:

<?php
// User defined values
$text_template_file = '/path/to/text/template/file';
$html_template_file = '/path/to/html/template/file';
$thank_you_page_url = 'http://url/to/thankyou.htm';
$from_name = 'From Name';
$from_email = 'From Email';
$to_email = 'To Email';
$subject = 'Subject';
// Open template files
$text_template_file_handle = fopen($text_template_file,'r');
$html_template_file_handle = fopen($html_template_file,'r');
$text_template = fread($text_template_file, filesize($text_template_file));
$html_template = fread($html_template_file, filesize($html_template_file));
fclose($text_template_file_handle);
fclose($html_template_file_handle);
foreach ($_POST as $name => $value) {
    $pattern = '/\[' . $name . '\]/’;
    $value = stripslashes($value);
    $text_template = preg_replace_all($pattern,$value,$text_template);
    $html_template = preg_replace_all($pattern,$value,$html_template);
}
$boundary = uniqid(’np’);
$headers = “MIME-Version: 1.0\r\n”;
$headers .= “From: $from_name <$from_email>\r\n”;
$headers .= “Subject: $subject\r\n”;
$headers .= “Content-Type: multipart/alternative;boundary=” . $boundary . “\r\n”;
$message .= “\r\n\r\n–” . $boundary . “\r\n”;
$message .= “Content-type: text/plain;charset=utf-8\r\n\r\n”;
$message .= $text_template;
$message .= “\r\n\r\n–” . $boundary . “\r\n”;
$message .= “Content-type: text/html;charset=utf-8\r\n\r\n”;
$message .= $html_template;
$message .= “\r\n\r\n–” . $boundary . “–”;
mail($to_email, $subject, $message, $headers);
header(”location: $thank_you_page_url”);
?>
That’s all there is to creating a PHP mail form. With minimal modifications, you can replace the default subject line, from name, and from email address with form input.

Copyright notice. This script and tutorial was prepared by thewebhostcompany.com. You may use the script for any purpose, and post copies of this tutorial without restriction provided that this copyright notice is retained.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Webnews
  • MisterWong
  • Y!GG
  • Google Bookmarks
  • Technorati
Tags: , , , , , , , ,

The idea of placing hard limits on web hosting customers is quickly becoming a thing of the past. Disk drives are inexpensive, and so is bandwidth.

In fact, the cost of managing a client base with different quotas, handling requests for upgrades and support tickets resulting from users running out of resources due to hitting those limits is more expensive than the resources that such quota systems were developed for the purpose of managing.

There is no such thing as a hard disk with unlimited capacity, nor is there such a thing as unlimited data transfer speed or capacity. However, there is such a thing as an unlimited web hosting account in terms of not imposing restrictions on system resources for individual users… web unlimited is the direction thewebhostcompany.com has gone in order to serve our customers better, as well as reduce operating costs.

We now offer just one plan, one web unlimited plan. Many others have followed suit, but it is important to carefully monitor usage and not allow servers to become overpopulated. At thewebhostcompany.com, we make sure that web unlimited accounts perform to our customers’ expectations by adding resources as necessary and not allowing servers to become crowded enough for resources to be unavailable for any given client.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Webnews
  • MisterWong
  • Y!GG
  • Google Bookmarks
  • Technorati
Tags:

cPanel is the industry standard web hosting account control panel. cPanel is included for free with our hosting plans.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Webnews
  • MisterWong
  • Y!GG
  • Google Bookmarks
  • Technorati
Tags: