html - Javascript Validation Save Data to MySql not working -


This case, I want to validate the form. First of all, it will check the data in MySQL if there is a similar value, the validation will be seen 'data can not be entered' verification has been run but, if I click on the submit button, the data will still be available to MySQL data Saves, however the data is wrong. Therefore, the data can not be stored in mysql before filling out the form with the correct price. Thanks for helping me.

This is my PHP script.

  & lt; Form class = "form-horizontal" action = 'upload_data.php' method = "POST" enactie = "multipart / form-data" name = "" id = "" & gt; & Lt; Div class = "control-group" & gt; & Lt; = "Data" for label class = "control-label" & gt; ID Couple & lt; / Label & gt; & Lt; Div class = "control" & gt; & Lt; Input type = "text" id = "id_kapal" name = "id_kapal" placeholder = "class =" input-excel "required autofocus & gt; & Lt; Br / & gt; & Lt; Span id = "availability_status2" & gt; & Lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "control-group" & gt; & Lt; Div class = "control" & gt; & Lt; Button class = "BTN BTN-Success" & gt; Submit & lt; / Button & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Form & gt;  

This is Javascript

  & lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {$ ("id_kapal"). Change (function () {var id_kapal = $ ("# id_kapal"). Val (); if (id_kapal.length & gt; 3) { $ ("# Availability_status2"). Html ('& lt; img src = "../ Property / IMG / Verification / Loader gif" align = "absmiddle" & gt; & amp; nbsp; Checking availability. .. ''; $ (. ("Server_response == '0') {$ (" # availability_status2 ") ($ (" server_response == '0') {. ("Server_response == '0') .HTML ( Font color = "green" & gt; data can be entered & lt; img src = "../ property / img / verification / available page" align = "absmiddle">   

This is mysql-php script

  & lt; Php include 'connect.php'; If (isset ($ _ POST ['id_kapal'])) {$ kapal = mysql_real_escape_string ($ _ POST ['id_kapal']); $ Check_for_kapal = mysql_query ("Select * from Jodwal where id_kapal = '$ kapal'"); If (mysql_num_rows ($ check_for_kapal) == 1) {echo '1'; // if there is a record in the database - not available} and {echo '0'; //// No records found - id_kapal is available}}? & Gt;  


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -