<title> School Registration Form </title>
Does the PHP script get executed? If it doesn’t insert, what error message do you get?
</script>. Other than that, don’t use the deprecated mysql_* functions. If this is a school assignment, ask your teacher to each you something more up-to-date like mysqli_* or PDO. Also, I don’t see
register3.php yet. Is it at the bottom of the page?
I think the OP posted the code of the form and the code of register3.php together, so the PHP code isn’t actually part of the form.
Ok, so all 3 files are together? Alright, well I’m going to test these to make sure they aren’t inserting empty fields first.
1st is html page. 2nd is script3.js 3rd is register3.php. u remove validation. it ll store in db
values are storing in db if i dont use validation
Ok, I see where the problem is. You are getting undifined index for all of your
$_POST values. You appended a
1 after every
$_POST value. Your fields on the HTML part has no
$_POST value ending in
Also, you might want to update your snippet. There are no validations via PHP and you are very prone to SQL Injections. You need to ask the teacher if you can bring the snippet up-to-date. You are inserting raw value into the database. So if I type something like
DROP DATABASE users33
It will literally delete the whole table without you even knowing it. That is a really bad idea.
@sunayana_patil, it’s been posted around here before, but this XKCD cartoon seems appropriate at this point to illustrate the consequences of not validating data as it’s entered into a database.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.