-7
Wie löst man eine SQL-Abfrage auf einem HTML-Button?Eine SQL-Anfrage auf eine HTML-Schaltfläche auslösen
Wie löst man eine SQL-Abfrage auf einem HTML-Button?Eine SQL-Anfrage auf eine HTML-Schaltfläche auslösen
Ich würde jQuery verwenden.
$("#submit").on("click", function(){
$.ajax({
\t \t \t type: "post",
\t \t \t url: "process.php",
\t \t \t data:"action=SomeActionHere",
\t \t \t success: function(data){
\t \t \t \t alert("SUCCESS");
\t \t \t },
\t \t \t error: function(e){
\t \t \t \t alert("ERROR");
\t \t \t }
\t \t });
};
<!--index.html -->
<button id="submit">GOGO</button>
<!--process.php-->
<?php
header("Content-type: application/json; charset=utf-8");
//connecto to server
$action = $_POST['action'];
if($action == "SomeActionHere"){
// do you sql stuff here
// when done sql
echo json_encode("SUCCESS"); // whatever data you want to send back
}
?>
Haben u versucht [google] (https://www.google.pl/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=Trigger+a + sql + Anfrage + an + an + html + Taste)? – Arkej
Mit Ajax-Anfrage, und rufen Sie ein PHP-Skript mit Ihrer SQL-Anfrage –