I am trying to create a button that onclick would pass a mysqlquery for inserting some data into a testtable. My script looks like this:
<?php
function AddCount(){
$con = mysqli_connect(connectvalues);
$query = "INSERT INTO testtable VALUES (1);";
mysqli_query($con, $query);
};
?>
<button style"button" onlick="AddCount()">Click me</button>
However it doesn't work. Any tips? PS. I'd like to use that simple script as an example for a bigger script that I'm going to use in my online shop project. So the function in the next button I'll make will be more complicated but right now I only need a pattern to follow. Thank you in advance!