0
I’m trying to make it only send to the database when you click the put button every time the page is loaded even if you don’t click the button. This is the code I’m using
<script>
var text = "foi clicado"
</script>
<button onclick="myFunction()">Click me</button>
<script>
function myFunction() {
document.getElementById("d").innerHTML = "<?php
include 'conect.php';
$ts = "<script>document.write(text)</script>";
$TS2= $ts;
$sql ="INSERT INTO `ss`(`nome`) VALUES ('$TS2')";
$query = mysqli_query($link, $sql) or die(mysqli_error());
?>";
}
</script>
if you have any way to connect to the database via javascript and be safe I am happy to know also
thanks helped a lot
– romulo henrique