I am trying to send values from POST variable to Python 2.7 using shell_exec
function of PHP. When I try to use the pre-defined variables, it gives the correct results, and when I use POST variables, it does not send parameters to the python file. and also the python script doesn't execute.
I am using AJAX method to call this file
//Does not work in this case
$age = (int)$_POST['age'];
$gander = $_POST['gander'];
$occupation = $_POST['occupation'];
$n = 5;
//Works when used like this
$age=25;
$gander='M';
$occupation='engineer';
$n=5;
//For result displaying
$res = shell_exec("py -2 main.py $age $gander $occupation $n ");
echo $res;