I want to send a string to python function from a form in php file.
The python function which receives the "string argument" will process it and return the "result string" back in the same php file and display it.
Please guide me how to do it.
Update I am using xampp server on Windows8.1, and Python3.6.4 I have used shell_exec() successfully to send arguments from php to python but unable to return variable back to php from python.
My PHP code: (index.php)
$param1 = "abc";
$param2 = "xyz"
shell_exec("python C:/python/echo.py $param1 $param2");
My python code (echo.py)
import sys
x = sys.argv[1]
y = sys.argv[2]
print(x)
print(y)
#here I want to return string
#return "code executed successfully"
# and receive this sentence back in new.php file & display it with proper css
(Note: I have already read answers to many similar questions on StackOverflow but couldn't find an answer specific to this scenario)