This is the php code
<?php
$con=mysqli_connect("localhost","root","","my_db");
$response = array();
header('Content-Type: application/json');
if (mysqli_connect_errno($con)) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$username = $_POST['_username'];
$password = $_POST['_password'];
var_dump($_POST);
$result = mysqli_query($con,"SELECT Role FROM user_details where
useremail='$username' and userpassword='$password'");
$row = mysqli_fetch_array($result);
$data = $row[0];
if($data){
echo $data;
}
mysqli_close($con);
?>
http://localhost/android_login_api/mycon.php?username=m@gmail.com&password=1234
It gives the following error
Undefined index: username in C:\xampp\htdocs\android_login_api\mycon.php on line 12
I tried the GET, without passing parameters then I can return the values. But here I am working on a login screen so I need to use POST method to capture the values.
Appreciate your guidance on this Using xampp V3.2.4