It would help if you had told us which server side language you are using i.e. Clasic ASP, ASP.Net, C#, PHP, Cold Fusion to help us to give you an answer specific to your scenario.
The basic principle is as follows :-
<form method="post" action="receiver.asp">
//Validation code goes here.
<input type="text" name="txtUsername"/>
<input type="text" name="txtPassword"/>
<input type="button" value="click" onclick="validate();">
Username = Request.Form("txtUsername")
Password = Request.Form("txtPassword")
Set oADOCmd = Server.CreateObject("ADODB.Command")
Set oADOConn = Server.CreateObject("ADODB.Connection")
Add code here to compare the values entered by the user with those within your database table.
This could either be done using output parameters or recordsets although recordsets are a bit "old hat" these days.