Reputation: 193
I have seen many other posts which supposedly contain the solution for this problem, but I could not solve it with them.
I'm creating a login page
<form action="https://www.tjoliveirafpereira.000webhostapp.com/code/CheckUser.php" method="post">
<div class="row">
<div class="six columns">
<label for="NMEC">Nº Mecanográfico:</label>
<input required class="u-full-width" type="text" id="NMEC">
<label for="PIN">PIN:</label>
<input required class="u-full-width" type="text" id="PIN">
</div>
</div>
<input class="button-primary" type="submit" value="Entrar">
</form>
but when I print_r the $_POST variable, it shows that is empty (Array( ))..
print_r( $_POST);
Can anyone help me?
Upvotes: 1
Views: 98
Reputation: 363
You are missing the name attribute in your input fields. Try this:
<form action="https://www.tjoliveirafpereira.000webhostapp.com/code/CheckUser.php" method="post">
<div class="row">
<div class="six columns">
<label for="NMEC">Nº Mecanográfico:</label>
<input required class="u-full-width" name="myNMEC" type="text" id="NMEC">
<label for="PIN">PIN:</label>
<input required class="u-full-width" name="mypin" type="text" id="PIN">
</div>
</div>
<input class="button-primary" name="mysubmit" type="submit" value="Entrar">
</form>
Upvotes: 6
Reputation: 11
You have not mentioned name attribute for text boxes having id="NMEC" and id="PIN", add name="NMEC" and name = "PIN" in the respective text boxes.This will solve the problem.
Upvotes: 0