I want to send a couple of form fields as a POST request to my PHP page, but I can\'t get it to work. Here is my code:
PHP login.php
Your inputs do not have name
s. The id
is used for client-side referencing, but it is the (non-unique) name
attribute that is used to determine the key for a value when the data is submitted. A form control cannot be successful (i.e. in the form data) without a name
.
You haven't included the name
attribute in your html input elements. name attribute is used when passing form information to the webserver. id
is primarily used for javascript based manipulation.
Username<input type="text" name="username"/>
Password<input type="password" name="password"/>