I have this html button
<div class="test-page">
  <div class="form">
    <form class="test-form" action = 'test.php' method="get">
      <button>Run</button>
    </form>
  </div>
</div>
When i click the button i want the test.php file to run. Which displays results from a table in my local database.
<?php
$conn_array = array (
    "UID" => "username",
    "PWD" => "password",
    "Database" => "dbname",
);
$conn = sqlsrv_connect('servername', $conn_array);
if ($conn){
    echo "connected"; 
}else{
    echo "Failed";
}
$query = "select * from [Table1]";
$result = sqlsrv_query($conn,$query);
while ($row = sqlsrv_fetch_array($result)){
echo "<br>";
echo $row['Id'];
echo " ";
echo $row['Email'];
echo " ";
echo $row['Password'];
}
?>
However, when i click the button it just opens the php file. What am i missing here? I have the html and php file in htdocs folder in xamp folder. Is this the correct place? Any advice would be great. thanks!
 
    