try to add an id to each form. and change
<input type="submit" name="" value="">
to
<button type="button" onClick="test()">Submit</button>
example
<h3>Delete a student</h3>
<form id="deleteStudent" method="post" action="connect.php">
ID : <input type="text" name="id"><br><br>
<button type="button" onClick="test()">Submit</button>
<br>
</form>
last add javascript
<script>
function tes(){
document.getElementById('deleteStudent').submit()
}
</script>
You cannot have nested forms. Please close your forms properly and retry
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 🙁
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!
I am invoking all of them individually through a button but what is happening is that every button just triggers the same form.
@MrBuddyboi — Why are you making a comment repeating what you said in the first paragraph of your question instead of addressing the issues raised in other people’s comments?
This is not answer. You could have written this post as comment at the bottom of the question.
Your answer could be improved with additional supporting information. Please