I am running into a strange error on a website using multiple PHP scripts. For some reason, every submit button only calls the first PHP script defined rather than the one chosen. I know all of these scripts work and this issue started only recently. Here is the code in question:
<!DOCTYPE html>
<html>
<head>
<title>Embed PHP in a .html File</title>
</head>
<body>
<h2>POV</h2>
<form action="index.php">
<button type="gohome">Return to main form</button>
</form>
<h3>WIP Final results:</h3>
<br>
<?php
include("showdatabasecontents.php");
?>
<form method="post" action="clearFinal.php">
<input type="submit" name="clearFinal" value="Clear Responses">
<form method="post" action="resetFinal.php">
<input type="submit" name="resetFinal" value="Reset ID Count">
<h3>Students names</h3>
<?php
include("showdatabasecontent2.php");
?>
<h3>Add a Student</h3>
<form method="post" action="addstudent.php">
Student Name : <input type="text" name="studentname"><br><br>
<input type="submit" name="addstudent" value="Submit">
</form>
<h3>Delete a student</h3>
<form method="post" action="connect.php">
ID : <input type="text" name="id"><br><br>
<input type="submit" name="removeStudent" value="Submit">
<br>
</form>
</body>
</html>
I have tried changing some of the names for the buttons to make sure there was not a conflict but that did not make any different. Any info on this issue will help, thanks!
3
Answers
Found the issue, at the advice of Quentin, I used https://validator.w3.org/. I came to the conclusion based on the information I drew that I was missing a closing tag for two form elements. I would mark this as solved but stackoverflow won't let me for two days :(
You cannot have nested forms. Please close your forms properly and retry
try to add an id to each form. and change
to
example
last add javascript