Once you’ve got an established blog you’ll most likely want a contact page with a contact form on it. Whilst there are a few plugins that do this for you, I tend to find that they either bloat your pages with additional CSS code in the header (CSS code should always be put in an external stylesheet whenever possible), badly written form markup, or probably the worst culprit, the PHP code doesn’t validate the information in the form to help prevent spam or email header injection.
Create your Page Template
First of all we need to create a new page template. Take your page.php template file (or index.php if you don’t have a specific page template file) and save it as contact.php. At the top of the file, just after the opening PHP tag, insert the following:
/*
* Template Name: Contact Page
*/
This will now show up as a page template when you come to create your static Page in WordPress.
The Form Markup
In your template file, find the template tag the_content(). It may differ slightly to the basic tag, or it may even be the_excerpt() (if it is then change that to the_content();). Just below this tag you want to insert your form markup. You may want to have additional fields, if so just duplicate the appropriate code and edit it for each additional field. Do not remove the fields already in the form however, else the PHP code to validate the form will not work.
[sourcecode language="html"]








It's another good tip to try. Thank you.
I never really thought about putting a contact page on my blog. I guess it is something worth doing and making it easier for [eople to contact me.
Very simple form …
This looks like it could be really helpful, but … stupid question #1: How do you create a php page template? I have no idea!
u just need to use Dreamwearver but to run a php page u need a server, create a local host by wamp
Thanks for the tip, however apart of my lack of PHP knowledge, so far I've been very pleased with cforms II plug-ins.<blockquote cite="cforms is a highly customizable, flexible and powerful form builder plugin, covering a variety of use cases and features from attachments to multi form management, you can even have multiple forms on the same page!">
@Deb, you'll need to read the earlier post of Page Templates – Create a Links Page for an indepth look at creating a page template.
@Budhi, cforms II looks alright but is quite bloated codewise for a basic form. Also, my 'WordPress Design and Coding' posts wouldn't amount to much if I just said use a plugin
These posts are for people who would rather learn how to do things themselves or at least learn how to modify what they already have.