Praktik 2

 PRAKTIK 2

Source code

koneksi.php

<?php
$host = mysqli_connect("localhost","root","","dbdimas");
?>

db.php

<?php
include "koneksi.php";
$sql = mysqli_query ($host, "SELECT * FROM tbdimas ORDER BY ID DESC LIMIT 1 ");
foreach ($sql as $row) {
    echo $row["nama"];
    echo "<br>";
    echo $row["kelas"];
   
}
?>

index.php

<?php
require 'koneksi.php';
if (isset($_POST['Submit'])) {
}else {

}
?>

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width, initial-scale=1">
        <title>Praktik 2</title>
</head>
<from method="POST">
    <label>Nama :</label>
    <input type="text" name="nama">
    <br>
    <label>Kelas :</label>
    <select name="kelas">
        <option value="X">X</option>
        <option value="XI">XI</option>
        <option value="XII">XII</option>
</select>
<br>
<br>
<input type="submit" name="submit" value="submit">
<input type="reset" name="reset" value="Reset">

</from>
</table>
</body>
</html>

HASILNYA :




Komentar

Postingan populer dari blog ini

situs web penjadwalan pertemuan