[Solved] having problems when inserting 6 marks in 6 school subjects [closed]


All of your name‘s for inputs are the same, so it only can see one of them, it doesn’t know the difference between "mark" and "mark" and "mark" etc. Add different id’s to them, like “mark1” etc.

Then in your php, MAKE SURE TO SANITISE THE INPUTS!! or else people can use sql injection to echo out absolutely everything including the schema of all your databases.

Check the inputs using their names, like $mark1 = $_POST['mark1']; Again, sanitise $mark1 even if it is only you using it locally. It’s good practice (:

EDIT:

Problems:
*In your SQL Query, you never use the php variable $mark, because you add “$mark” as a string to the database.

*You don’t sanitise any of the user input, so this db is vulnerable to attack

*Your HTML Inputs in the form all have the same name “mark” so the php doesn’t know the different data inside each one, because they are all called the same.

Steps to resolve this:

*Give your HTML Inputs unique name attributes.

*In your PHP, get those unique name attributes as unique variables.

*Change your Query from '$mark' to '" . $mark1 . "', etc.

*Sanitise your inputs, there are plenty of topics on SO to learn this.

4

solved having problems when inserting 6 marks in 6 school subjects [closed]