value from text field

i have a text-field in view .i want to compare that text field value from data.for example if i enter email in text field it will compare the email from database n generate a random number which will update as password in the user table .plz give n example with code.i am really getting confuse some times.

Do U want to do this on server or client side ?

on client side sir.

If I understood U right, something like this should work:

$(document).ready(function() {

var dbVaue = '<?php echo $dbEmail;?>'; // this will hold your db value

$('#yourForm').on('submit', function(e) {


     if( dbValue == $('#yourTextFieldID') {

        ..... do want U want to do....

     } else {

        alert('your email does not match'); // infortm user about error