For client-side validation, check out this demo:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Demo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#myForm").submit(function(){
var isValid = true;
if($("#txtName").val().trim().length == 0) {
isValid = false;
alert("Name cannot be empty!");
}
return isValid;
});
});
</script>
</head>
<body>
<form id="myForm" action="#" method="post">
<input type="text" id="txtName">
<input type="submit" value="Send">
</form>
</body>
</html>
JSFiddle[
^]
As regards to:
Quote:
textbox values are unique (avoiding duplicates) in the database
That can only be done on the server-side by checking the value against the database content.