How to use form Textbox input into php variable

Assigning HTML textbox <input> value to PHP variable

Username:

Text-boxes are commonly use to get input from the user in php using HTML
The above username text field has following below code..


<form>

 <input name="username_input" type="text/>
<input name="password_input" type="password/>

</form>

  • The name of input text boxes are"username_input",password_input  that we use below in php code
  • The type of input text box are 'text','password' it may be 'email' ...etc
<?php

$username=$_POST['username_input'];
$password=$_POST['password_input'];

?>

$username  is a php variable that store the value of textbox 'username_input'
$_POST[]; Is a php function that shows username_input,its a postvariable to be passed..

Lets use this variable in PHP code

$sql="select * from login where username=' ".$username." ' AND password=' ".$password." ' ";