Software >> PHP Classes >> Simple Contact Form
Created by James Blaha, Manish Gupta & filed under contact, form, php, class, email

Simple Contact Form Class v0.9

Description

This script allows you to easily make an error checking contact form for your website. With just five lines of code you get a stylable form that is safe and secure.

Instructions

Just copy simple-contact-form-class.php to your server and paste the following code where you want the form.

<?php
@include_once("simple-contact-form-class.php");
$email "youremail@yourdomain.com";
$contact = new contact;
echo 
$contact->accept_contact($email);
echo 
$contact->make_contact_form($email);
?>

Change your email and make sure the include points to wherever you put simple-contact-form-class.php on your server.

Styling Your Form

This is the default styling to add to your form. Copy contact-style.css to your server and include it by adding the following line in the head section of your page:

<link rel="stylesheet" href="/contact-style.css" type="text/css" />

Or add the following to your CSS file.

#contactform{
font-size:14px;
font-weight:bold;
}
#contactform p {
text-align:center;
}
#contactform input {
margin:3px 0 5px 0;
border:1px solid #555;
width:100%;
height:22px;
line-height:25px;
font-size:16px;
}
#contactform textarea {
margin:3px 0 5px 0;
border:1px solid #555;
width:100%;
height:100px;
}
#comment {
display:none;
}
.fail-box {
padding:10px;
margin:10px;
border:1px dashed #ccc;
background:#ffbbbb;
color:#222;
font-size:14px;
font-weight:bold;
}
.confirmation-box {
padding:10px;
margin:10px;
border:1px dashed #ccc;
background:#cceeff;
color:#222;
font-size:14px;
font-weight:bold;
}

You can change any of the CSS to your liking but leave the #comment the same, as this helps to prevent spamming.

There are no comments