0

I have a texbox in form. Need to post the textbox value and compare the mysql database in without submit. using integration php with javascript does not give any response. It means user give 10 digit number to textbox that value immediately post to database and compare the value and say does matched or not matched.thanks in advance.

<input type="text" id="txtcouponNumber" name="txtcouponNumber"/>

    <script text/javascript>
    $('#txtcouponNumber').keyup(function(){
        if(this.value.length ==10){
                <?php       
                $con=mysqli_connect('localhost','username','password','dbname');
                $query="select * from tb";
                $res=mysqli_connect($con,$query);
                while($cc=mysqli_fetch_array($res)){
                  if($cc['cc']=$txtcouponNumber){ // cc is my table column name
                 echo "Copupon Code is Matched!";
                 echo $cc['cc'];echo $cc['amount']; }
                 else {echo "Sorry! coupon Code Does not Match..";}  } ?>;
                 retrun cc;
                 }
    });          </script>

0 Answers0