Email Forms in PHP - (1/4) | WebReference

Email Forms in PHP - (1/4)

current pageTo page 2To page 3To page 4
[next]

Email Forms in PHP

By ( Dan Ball )

I recently admitted to myself that my home business should be moved off of the "free hosting" service I have had it on for about 3 years. Though the service was great, and it was very feature-rich as compared to any other free service I have seen, it is still subject to invasive maneuvers by the company itself. That said, I moved to a pay service. The immediate thrill was no banner code to add to my pages. The underlying benefit was their support of PHP (PHP Hypertext Preprocessor) pages and hosting a MySQL database. I knew when I signed up that they supported that; what I didn't know was how great that combination was, and how powerful PHP really is.

With this "rebirth" I have found in Web development with my introduction to PHP I have decided to dedicate a little bit of my time and a few pages to PHP and how easy it is to setup a very cool email feedback form with it. I have used various tools in the past to build forms and database connectivity, such as ASP, JSP and CGI/Perl. PHP, without a doubt, has been the most enjoyable to work with yet, with its familiar scripting syntax and predictable results.

Barebones PHP basics

A couple very basic concepts of PHP must be discussed before getting into this project further. First, PHP code is inserted into pages inside <?php and ?> tags. Second, any page that contains any amount of those tags should have the .php or .php3 extension. The .php3 extension is for pages that are using features that were new to version 3 of PHP. Check with your system administrator for any rules regarding which extension you need to use and the tags you need to enclose the code, because PHP is also designed to be custom configured to fit the way you are comfortable coding. It can be configured to use the ASP <% %> tags amongst other customizations that are beyond the scope of this article.

The PHP pages still contain a lot of typical HTML, so your pages will still need the typical <html>, <body>, etc. they just may not be right at the top like you are used to seeing because there may be PHP variables and such being defined before the <html> tag. Also, like JSP and ASP, if you do a view source at the client level, you will only see the HTML and client-side scripting, because by that time all the PHP has been read and processed by the server and the resulting HTML is fed to the browser.

With all that being understood, let's get on with the fun stuff.

current pageTo page 2To page 3To page 4
[next]


Created: July 30, 2001
Revised: July 30, 2001

URL: https://webreference.com/programming/javascript/phpemail/