I've created this PHP files that should read a python scripts with arguments and process this script.
$error = array();
$data = array();
include("./includes/common.php");
if($_SERVER["REQUEST_METHOD"] == 'POST' && isset($_POST["submit"])){
$lbl10 = filter_input(INPUT_POST, 'lbl10', FILTER_SANITIZE_STRING);
$filePath = uploadFile('C:/xampp/htdocs/GraduationProject/images/test/');
if(empty($error)){
$output = shell_exec("C:/xampp/htdocs/GraduationProject/includes/train.py {$lbl10} {$filePath}");
if($output){
$ret = $db->getData("WHERE ID='{$output}'");
while($row = $ret->fetchArray(SQLITE3_ASSOC)){
$data = $row;
}
}
$success = "Data saved successfully!";
}
}else if($_SERVER["REQUEST_METHOD"] == 'POST'){
$error[] = "Required Field Missing";
}
$db->close();
The PHP file should outcome some results according to the python script processing with the database after this if statement:
<?php if(!empty($data)){ ?>
But nothing happens as $data seems to be always empty.