I am new to php and I am trying to connect my android app with my computer using xampp server. First I tried to check the php code, using Postman(rest client). I tried to insert values by giving request through postman, but the null value is inserting. Can someone help me please
I have tried with other rest client apps but the same error occurs. I have used isset() function to check whether the value is set or not. The value is null
<?php
if($_SERVER["REQUEST_METHOD"]=="POST") {
require 'conn.php';//This is another php file for connecting php with
mysql
register();
} else{
echo "Please give post request";
}
function register()
{
global $conn;
if(isset($_POST['user']) || isset($_POST['pass'])){//Trying to check
weather it is null or not
$username = $_POST["user"];
$password = $_POST["pass"];
$query = "insert into login(username,password)
values('$username','$password');";
if(mysqli_query($conn,$query)) {
echo"Success";
} else {
echo"failure";
}
}else{
echo"Blank";//This is printing in that rest client
}
mysqli_close($conn);
}
?>