I have this HTML page that is supposed to be able to access 2 different PHP pages that each performs SQL. This first part of the HTML works and goes to the first PHP page but the second one isn't going. When I click on the button, the HTML page doesn't do anything. Here is my HTML code:
<html>
<body>
<form action="insertartist.php" method="post">
<h3>Artist Insertion:</h3>
First Name: <input type="text" name= "fname" placeholder="First Name"><br><br>
Last Name: <input type= "text" name= "lname" placeholder="Last Name"><br><br>
DOB: <input type= "text" name= "dob" placeholder="YYYY-MM-DD"><br><br>
Hometown: <input type= "text" name= "hometown" placeholder="Hometown"><br><br>
Gender: <input type= "text" name= "gender" placeholder="Gender"><br><br>
<input type="submit" value="Insert Artist"><br>
</form>
<form action="selectartist.php" method="post">
<h3>Select Artist Table:</h3>
<input type="submit" value="Select Artist Table"
</form>
</body>
Here is my PHP code for the second PHP page that isn't working: I removed the connection info for the database. I know it's correct because it is the same as the first PHP page which is working. It also doesn't give me any errors or do anything at all, I click the "Select Artist Table" button on the HTML page and it just sits there and nothing happens. I am very confused because the first page is working and is setup the same way.
<?php
$conn = mysqli_connect("???", "???",
"???", "???");
if (!$conn) {
die("Connection to SQL failed: " . mysqli_connect_error());
}
else {
echo "Established Database Connection: ";
}
$sql = "SELECT * FROM artist;"
$result = mysqli_query($conn, $sql);
$num_rows = mysqli_num_rows($result);
if ($result->num_rows > 0) {
echo "<table>";
echo "<tr><th>Artist ID</th><th>First Name</th><th>Last Name</th>
<th>DOB</th><th>Hometown</th><th>Gender</th></tr>";
while($row = $result->fetch_assoc()) {
echo "<tr><td>".$row["aid"]."</td><td>".$row["fname"]."</td>
<td>".$row["lname"]."</td><td>".$row["dob"]."</td>
<td>".$row["hometown"]."
</td><td>".$row["gender"]."</td></tr>";
}
echo "</table>";
} else {
echo "0 Results";
}
echo "$num_rows Rows
";
mysqli_close($conn);
?>