Heres is my form. i added your code, but i am not seeing any validation working
<?php
if (!isset($_POST['submit']))
{
echo '<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>EHP Online Claim Lookup</title>
<style>
<!--
.tborder
{
background-color: #445669;
color: #000000;
border: 1px solid #062647;
}
td
{
font: 10pt verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
}
.panelsurround
{
background-color: #F5F5FF;
color: #000000;
}
.panel
{
background-color: #F5F5FF;
color: #000000;
padding: 10px;
border: 1px;
}
.smallfont
{
font: 11px verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
}
td{font-family:arial,helvetica,sans-serif;font-size:79%;}-->
</style>
</head>
<form method="post" action="<?php echo self?>" name="registerForm" >
<body vlink="#000000" alink="#000000" style="border-style:inset; border-width:1; word-spacing: -1; margin: -1; position:absolute; text-align:left" bgcolor="#008080" link="#000000">
<div align="center">
<center>
<table border="0" cellspacing="0" width="60%" id="AutoNumber1" height="270" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0">
<tr>
<td width="100%" height="19">
<div align="center">
<center>
<table border="0" cellspacing="0" width="677" id="AutoNumber2" height="1" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0">
<tr>
<td width="692" align="center" bgcolor="#FFFFFF" valign="top" height="1">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="97%">
<tr>
<td width="100%">
<img border="0" src="reg.jpg" width="792" height="77"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="692" align="center" bgcolor="#669999" valign="top" height="1" bordercolor="#477678">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="792" height="282">
<tr>
<td width=827 bgcolor="#808080" height="19" colspan="4">
<p style="margin-left: 4">
<font face="Arial"><strong>Already have an ID
<a title="Click here to sign-in if you already have an ID" href="main4.html">
<font color="#0000FF">Sign In.</font></a></strong></font></td>
</tr>
<tr>
<td width=827 bgcolor="#C0C0C0" height="19" colspan="4">
<div class="smallfont" style="MARGIN-BOTTOM: 3px">
<p style="margin-left: 4">
<font size="2" face="Arial">In order to use this service, you must first
register.<br>
Please enter your Last name, First name, EHPID, Username,
and a Password.</font></div>
</td>
</tr>
<tr>
<td width=487 bgcolor="#808080" height="19" colspan="3">
<p style="margin-left: 4">
<font face="Arial"><b>Create a User ID</b></font></td>
<td width=354 bgcolor="#808080" height="19">
</td>
</tr>
<tr>
<td width=487 bgcolor="#C0C0C0" height="19" colspan="3">
<p style="margin-left: 4"><font size="2">Fields marked with an asterisk <span class="yregasterisk"></span> are
required.<spacer height="10" width="1" type="block" /></font></td>
<td width=354 bgcolor="#C0C0C0" height="19">
</td>
</tr>
<tr>
<td width=112 bgcolor="#C0C0C0" height="23">
<p style="margin-left: 4">
<font face="Arial">EHPID:</font></td>
<td width=156 bgcolor="#C0C0C0" height="23">
<font face="Arial"><input type="text" name="T2" size="20"></font></td>
<td width=210 bgcolor="#C0C0C0" height="23">
</td>
<td width=354 bgcolor="#C0C0C0" height="23">
</td>
</tr>
<tr>
<td width=810 bgcolor="#C0C0C0" height="19" colspan="4">
<p align="left">
<input type="button" value="submit" value="submit">
<input type="button" value="Reset" name="B1"></td>
</tr>
<tr>
<td width=810 bgcolor="#C0C0C0" height="13" colspan="4">
<p align="left">
<font size="2"> </font><font size="1"> Powered by Electronic Health
Plans</font></td>
</tr>
<tr>
<td width=760 bgcolor="#C0C0C0" height="4" colspan="4" valign="top">
<font face="Arial" size="1"> Copyright © 2000-2003 by Electronic Health Plans, Inc. All rights
reserved</font></td>
</tr>
<tr>
<td width=760 bgcolor="#C0C0C0" height="17" colspan="4" valign="top">
<p align="center"><b><font face="arial" size="-2"> To learn more
about how we use your information, see our</font><font face="arial" color="#8d8d8d" size="-2">
<a target="_top" href="m.htm">
<font color="#0000FF">Privacy Policy</font></a></font></b></td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table></center>
</div>
</form>';
}
else
{
mysql_connect('st', 'e', '9') or exit(mysql_error());
mysql_select_db('ehpadmin') or exit(mysql_error());
$result = mysql_query("SELECT COUNT(*) FROM test WHERE name = '" . $_POST['T2'] . "'") or exit(mysql_error());
if (mysql_result($result, 0)) {echo 'the user_id ' . $_POST['T2'] . ' is already in the database';}
else {echo 'the user_id ' . $_POST['T2'] . ' is NOT in the database';}
}
?>