Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="container" style="text-align: center;color:#55555">
- <h1>Išverskite žodžius į lietuvių kalbą:</h1>
- <?php
- $servername = "localhost";
- $username = "manant";
- $password = "eiPh3Ahx8ohTh8qu";
- $dbname = "manant";
- //Connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- //Check
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT * FROM politephrases";
- $result = $conn->query($sql);
- //Create an empty array
- $array = array();
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- $array[] = $row;
- }
- }
- $n = sizeof($array);
- //shuffle($array);
- for ($i = 0; $i < $n; $i++) {
- echo $array[$i]['id'] ." ";
- echo $array[$i]['word'] ." ";
- echo $array[$i]['transl'];
- echo "<br>";
- }
- echo "<br>";
- $i=0;
- echo "<h2>Žodis: </h2>";
- echo $array[$i]['word'];
- if(!empty($_POST)){
- $transl = $_POST['translation'];
- if($array[$i]['transl'] == $transl){
- echo "<br> PUIKU";
- $i = $i + 1;
- }
- else {
- echo "<br> NETEISINGAI";
- }
- }
- else {
- echo "Nieko neįvesta.";
- }
- $conn->close();
- ?>
- <form name="tr" method="post" action="polite-phrases-eng.php">
- <br>
- <input type="text" id="translation" name="translation" placeholder="Įrašykite žodžio vertimą">
- <!-- <input type="text" value="" name="translation" id="translation">-->
- <input type="submit" name="submit1" value="Vykdyti">
- </form>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement