I have a HTML form and I want to use the results to filter the data available in a SQL file. I'm trying to connect to a local MySQL server but It doesn't work, i don't achieve to enter in the table() function.
I use the following code:
<form id="form_id" action="food_values.php" method="post" name="myform">
...
<input onclick="table" type="button" value="Submit">
</form>
The php file contains the following code:
<html>
<body>
<?php
function table(){
echo ("INSIDE");
$con = mysql_connect("localhost","root"," ");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
else {
echo "CONNECTED";
}
}
?>
</body>
</html>
It doesn't show anything... Do you know where is the error?