<form method='post' action='contactusck.php'>
<table border="0" width="100%" cellspacing="0"
cellpadding="0">
<tr>
<td width="50%" class='topsub' align = center COLSPAN=2>
<B>CONTACT US / FEEDBACK FORM</B></font></td></tr>
<tr><td width="50%" bgcolor="#8080a6"><font
face="Verdana" color="#FFFFFF"> Your
First Name</font></td>
<td width="50%" bgcolor="#8080a6"> <font color="#FFFFFF" face="Verdana">
Your Last Name</font></td>
</tr>
<tr>
<td width="50%" bgcolor="dfdfdf" > <input
type='text' name='fname'></td>
<td width="50%" bgcolor="dfdfdf"> <input
type='text' name='lname'></td>
</tr>
<tr>
<td width="50%" bgcolor="#8080a6"><font
face="Verdana" color="#FFFFFF"> Email
Address</font></td>
<td width="50%" bgcolor="#8080a6"> <font
color="#FFFFFF" face="Verdana">Telephone No
</font></td>
</tr>
<tr>
<td width="50%" bgcolor="F1F1F1" > <input
type='text' name='em'><font
color="#FF0000"><B>*</b></font></td>
<td width="50%" bgcolor="F1F1F1"> <input
type='text' name='telephone'></td>
</tr>
<tr>
<td width="50%" bgcolor="#8080a6"><font
face="Verdana" color="#FFFFFF"> Address
1</font></td>
<td width="50%" bgcolor="#8080a6"> <font
color="#FFFFFF" face="Verdana">Address 2
</font></td>
</tr>
<tr>
<td width="50%" bgcolor="dfdfdf" > <input
type='text' name='ad1'></td>
<td width="50%" bgcolor="dfdfdf"> <input
type='text' name='ad2'></td>
</tr>
<tr>
<td width="50%" bgcolor="#8080a6"><font
face="Verdana" color="#FFFFFF"> City</font></td>
<td width="50%" bgcolor="#8080a6"> <font
color="#FFFFFF" face="Verdana">State
</font></td>
</tr>
<tr>
<td width="50%" bgcolor="F1F1F1" > <input
type='text' name='city'></td>
<td width="50%" bgcolor="F1F1F1"> <input
type='text' name='state'></td>
</tr>
<tr>
<td width="50%" bgcolor="#8080a6"><font
face="Verdana" color="#FFFFFF"> Country</font></td>
<td width="50%" bgcolor="#8080a6"> <font
color="#FFFFFF" face="Verdana"> Zip / Pin
</font></td>
</tr>
<tr>
<td width="50%" bgcolor="dfdfdf" > <select
name="country"><OPTION VALUE=Afghanistan>Afghanistan
<OPTION
VALUE=Albania>Albania
<OPTION VALUE=Zambia>Zambia <OPTION
VALUE=Zimbabwe>Zimbabwe</select></td>
<td width="50%" bgcolor="dfdfdf"> <input
type='text' name='zip'></td>
</tr>
<tr>
<td width="50%" bgcolor="F1F1F1" colspan='2'
align='center'> <textarea name="dtl" rows="4"
cols="40"></textarea></td>
</tr>
<tr>
<tr> <td bgcolor='#F1F1F1' colspan='2' align='center'><font
face='verdana, arial, helvetica' size='2' align='center'>
<input type='submit' value='Submit'> <input type='reset'
value='Reset'>
</font></td> </tr>
</table>
</form>
This form is posting all the variable to another page contactusck.php and there the visitor entries are validated. You can see the only compulsory requirement for the visitor to fill the email address and other input boxes are optional. You can check the form validation page of this site to get details on how to validate a form.
$status = "OK";
$msg="";
//error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
if (!stristr($em,"@") OR !stristr($em,".")) {
$msg="Your email address is not correct<BR>";
$status= "NOTOK";}
This is a very simple email validation, it is better to use php built in filter function to check email address.
mail("nobody@aol.com", "the subject", $message,
"From: webmaster@$SERVER_NAME\nReply-To: webmaster@$SERVER_NAME\nXMailer:
PHP/" . phpversion());
Here is the code we use in our site to send the details.
if($status=="OK"){// echo $query;
$headers="";
$headers4="webmaster@sitename.com"; ///// Change this address within
quotes to your address ///
$headers.="Reply-to: $headers4n";
$headers .= "From: $headers4n";
$headers .= "Errors-to: $headers4n";
$headers = "Content-Type: text/html; charset=iso-8859-1n".$headers;
mail("wemaster@sitename.com,otheraddress@hotmail.com,onemore@yahoo.com","Feedback
From plus2net.net","This is the feedback from plus2net.net
<BR>
First Name :$fname
<BR>Last Name :$lname
<br>Email
Addrss: $em<br>Phone no:$telephone<br>Address1:$ad1<br>Address2:$ad2<br>City:$city<br>
State:$state<br>Country:$country<br>Zip:$zip<BR><BR>
<BR> Message Details : $dtl","$headers");
echo "<center>Thank you <br><br> We will contact you
soon </center>";
}
Thats all. Our feedback form is ready. Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.