<?php $id=$_GET["id"]; //echo $id; if (!$id) exit; require_once "configs.php"; $sql = "select * from fixa where id=".$id; $res = $db->query($sql); if ($res) { $i=0; while ($row = $res->fetchArray()) { $title=$row["title"]; $title_th=$row["title_th"]; $tas=$row["tas"]; $scode=$row["scode"]; $i++; } //if ($i>0) { echo 'OK';} else {echo "NO";} $db->close(); } ?> <form action="javascript:myfuncfxa()" class="noselect"> TITLE:<br> <input type="hidden" id="id" name="id" value='<?php echo $row["id"];?>'> <input type="text" id="title" name="title" size="100" value='<?php echo $title?>' required autofocus>[en]<br> <input type="text" id="title_th" name="title_th" size="100" value='<?php echo $title_th;?>' required >[th]<br><br> TAS:<input type="text" id="tas" name="tas" size="50" value='<?php echo $tas;?>' ><br> Q:<input type="text" id="qbox" name="qbox" size="10" value='<?php echo $scode;?>' ><br> <input type="submit" class="button1 grey" value="💾Update"> </form> <script> function myfuncfxa() { var id = document.getElementById("id").value; var x = document.getElementById("title"); var y = document.getElementById("title_th"); // var y = document.getElementById("iemail"); var z = document.getElementById("tas"); var w = document.getElementById("qbox"); server="z_updfixa.php"; // snackbar2reload(); // snackbar2; datapack={}; //dont need this -as issue with special charactor // datapack.name=btoa(en1.value); //decode =atob datapack.x=(x.value); datapack.y=(y.value); datapack.z=z.value; datapack.w=w.value; datapack.id=<?php echo $id;?>; data=JSON.stringify(datapack); params="postdata="+data;//+row2+cmd1+cmd2; var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { //document.getElementById(param).innerHTML = this.responseText; //document.getElementById("snackbar2").innerHTML = this.responseText; //reloadme(); // snackbar2(this.responseText); // snackbar2reload(); if (this.response == "OK") { alert(x.value+" Updated"); window.location.replace(document.referrer);} else { alert(this.response); } } }; xhttp.open("POST",server, true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send(params); } </script>
Edit file:zupdtfixa-20210911140010.php2951