I have a PHP file with multiple if statements where it checks if is set $_POST['something'] and returns specific data but when I try with ajax I can't get the data inside if statement because it isn't triggered to be true, here is what I am doing: From index.php I am sending a request to users.php like this
<script>
axios.post('users.php').then(data=>console.log(data)); // this returns status 200 but data is empty
</script>
and the users.php looks like this
if(isset($_POST['getusers']))){ return users;}
How can I make this to true isset($_POST['getusers'])
by sending the request using Axios or fetch API?
Note: There are other if statements inside the users.php file that's why I want to only get when a specific $_POST is set