<form action='' method='POST'>
<table width='300' border=0>
<tr>
<th>Simple Registration</th>
</tr>
<tr>
<td>Username: <input type='text' size='15' name='user'></td>
</tr>
<tr>
<td>Password: <input type='password' size='15' name='pass'></td>
</tr>
<tr>
<td><input type='submit' name='reg' value='Register'></td>
</tr>
</table>
</form>
<?php
if(isse($_POST['reg']))
{
$user = $_POST['user'];
$pass = $_POST['pass'];
if((empty($user)) OR (empty($pass)))
{
echo('<script language="javascript">alert("You need to fill all fields!");</script>');
}
$username_exist = mssql_query("SELECT * FROM MEMB WHERE account='$user'");
$username_exist = mssql_num_rows($username_exist);
if($username_exist == 1)
{
$error = 1;
echo "<center>Вече има такъв потребител!</center>";
}
else
{
$import = mssql_query("INSERT INTO MEMB (account,password) VALUES ('$user','$pass')");
echo "$user has been added";
}
}
?>