}
        }
    } else {
        if (isset($_POST["translate"])) {
            //echo '<body> to traduzindo <br/></body>'
            // translating text
            if (empty($_POST["originalText"])) {
                //echo '<body> ta vazio <br/></body>'
                $originalTextErr = "Text is required (at least 3 words)";
            } else {
                //echo '<body> tem coisa <br/></body>'
                $originalText = test_input($_POST["originalText"]);
                $name = test_input($_POST["name"]);
                $srcLang = $_POST['srcLang'];
                $tgtLang = $_POST['tgtLang'];
                $translation = testLangID($originalText, $srcLang, $tgtLang);
                //echo "Traducao: " . $translation;
            }
        } else {
            echo 'No button origin <br/>';
        }
    }
}
//Query the DB for feedbacks
$strsql = "select * from TEXT_TABLE ORDER BY ID DESC limit 100";
if ($queryRes = $mysqli->query($strsql)) {
    // There are results
} else {
    // No results found
    echo "<b>Please <a href = init.php>Create table</a> first.</b>";
}
Example #2
0
    $cancer = $decoded['languages'][0]['language'];
    var_dump($cancer);
    return $decoded;
}
// define variables and set to empty values
$textLID = "";
$textLIDErr = "";
$textLang = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (empty($_POST["textLID"])) {
        $textLIDErr = "Text is required (at least 3 words)";
    } else {
        $textLID = test_input($_POST["textLID"]);
    }
}
$textLang = testLangID($textLID);
function test_input($data)
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
}
?>
 
     <table>
         <tr>
             <td style='width: 30%;'><img class = 'newappIcon' src='images/newapp-icon.png'>
             </td>
             <td>
                 <h2>Watson Language Identification</h2>