I am trying to create a php login page, and capture the username and password input into html text boxes. But my issue is that my echo statement always returns null for the variables.
Why are these variables not beting set?
<?php
include("config.php");
session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$myusername = mysqli_real_escape_string($db,$_POST['username']);
$mypassword = mysqli_real_escape_string($db,$_POST['password']);
echo $myusername;
echo $mypassword;
}
?>
<html>
<head>
<title>Login Page</title>
<style type = "text/css">
body {
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
}
label {
font-weight:bold;
width:100px;
font-size:14px;
}
.box {
border:#666666 solid 1px;
}
</style>
</head>
<body bgcolor = "#FFFFFF">
<form action = "" method = "post">
<label>UserName:</label><input type = "text" name = "username" class = "box"/><br /><br />
<label>Passwore:</label><input type = "password" name = "password" class = "box" /><br/><br />
<input type = "submit" value = " Submit "/><br />
</form>
</body>
</html>
EDIT
This is my config.php where I am using the mysqli_connect()
<?php
define('DB_SERVER', 'localhost:3036');
define('DB_USERNAME', 'user');
define('DB_PASSWORD', 'pass');
define('DB_DATABASE', 'db');
$db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
?>
var_dump($_POST)show?defineline. You have a curly quote instead of a straight quote.