Skip to content
Advertisement

Why html page does not read the php page

I have a problem when I click on the submit button there is nothing happened and my data is not being inserted into the database.

I’m trying to make a registration page(register2.html) and db_reg.php to sent the data into the database.

but what I figure out that the Html page does not even read the PHP page.

db_reg.php

JavaScript

register2.html

JavaScript

Advertisement

Answer

Your PHP script is waiting for $_POST["register2"] which never arrives.

Here -> make sure your submit button have a name="register2" attribute OR you could add a <input type="hidden" name="register2" somewhere inside your html form

JavaScript

I don’t use bootstrap, but I guess the mark-up above would be turned into a submit button, if that’s the case, you could add the name="register 2" attribute to it as follows

JavaScript

EDIT At the top of your PHP script, you could check what your$_POST variable contains by calling var_dump($_POST) and see if your form data is present.

If they’re not present, you may need to change the markup above to a submit button as follows

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement