Hello I wrote a small website. If i click on the Button a php script will start and give me some results of my sql database back. i want run the script on the site where my button is and not on a new site.
index.php
<html>
<head>
</head>
<body>
...
...
<form action="function.php" method="get">
<input type="submit" value="Button">
</form>
...
...
</body>
/<html>
function.php
<html>
<body>
<?php
require_once ('connection.php');
$db_link = mysqli_connect (
MYSQL_HOST,
MYSQL_USER,
MYSQL_PASS,
MYSQL_DB
);
$sql ="SELECT * FROM table" ;
if ($result = $db_link->query($sql) ) {
echo "<p>Your login details: </p><table>";
while ($row = $result->fetch_array() ) {
echo "<tr>";
echo "<td>", "$row[0]","</td>";
echo "<td>", "$row[1]","</td>";
echo "</tr>";
}
echo "</table>";
$result->close();
}
else {
echo "Problem SQL";
}
$db_link->close();
?>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire