sql - PHP update database with checkbox -


I am a newcomer at AJAX and I try to change a value on my database pending on a checkbox. I am using the following code:

  & lt; Script type = "text / javascript" & gt; Function update (id_submit, check) {check = (check == true? 1: 0); Var url = "check_validate.php.php? Id_submit =" + id_submit + "& amp; chkYesNo =" + check; If (windows.XMLHttpRequest) {req = new XMLHttpRequest (); } And if (windows.ActiveXObject) {req = new ActiveXObject ("Microsoft.XMLHTTP"); } Req.open ("GET", URL, true); Req.send (zero); } & Lt; / Script & gt;  

Then I get another value from my database:

  while ($ row = mysqli_fetch_array ($ result, MYSQL_ASSOC)) {$ check = $ Row ['checkbox']; $ Id_submits = $ zeile ['id_submits']; ? & Gt; & Lt; Td style = 'text-align: center; Width: 120px; ' & Gt; & Lt; Input name = "check" type = "checkbox" id = "check_ " Value = "& lt ;? php echo $ id_submits ;? & gt;" Onclick = "check (& ​​lt ;? php echo $ id_submits;? & Gt; test;);" & Lt ;? Php if ($ check == 1) {echo "check"; } Else {echo "";}? & Gt; /> & Lt; / Td> & Lt ;? Php  

and then I have "check_validate.php"

  $ id_submit = $ _GET ['id_submit']; $ CHKYesNo = $ _GET ['CHKYesNo']; Need_once ('config.php'); $ Sql ​​= "Update Table 1 SET checkbox = $ chkYes is not WHERE id_submits = $ id_submits"; $ Result = mysqli_query ($ link, $ sql);  

But nothing happens to my database, what am I doing?


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -