Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- listprofile.php
- <?php
- include "conf.php";
- $sql = "SELECT * FROM teacher";
- $query = mysqli_query($conn, $sql);
- if(!$query){
- echo "ไม่สามรถเรียกข้อมูลได้...";
- echo "กรุณารอสักครู่...";
- header('refresh: 3; url=./index.php');
- }
- ?>
- ้<!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <link rel="stylesheet" href="css/list.css">
- <title>รายการข้อมูลทั้งหมด</title>
- <style>
- body{
- background-color: #668cff;
- margin: 0;
- padding: 0;
- color: white;
- }
- .tb{
- position: absolute;
- top: 100px;
- left: 30%;
- }
- table{
- border: 1px solid black;
- background-color: black;
- width: 100%;
- }
- .data{
- background-color: white;
- color: black;
- }
- button{
- cursor: pointer;
- background-color: blue;
- color: white;
- border-radius: 15%;
- overflow: auto;
- }
- </style>
- </head>
- <body>
- <div class="tb">
- <table>
- <tr>
- <th>Username</th>
- <th>Password</th>
- <th>full Name</th>
- <th>Department Name</th>
- <th>photo</th>
- </tr>
- <?php
- while($result = mysqli_fetch_array($query)){
- ?>
- <tr class="data">
- <td><?php echo $result['username'] ?></td>
- <td><?php echo $result['password'] ?></td>
- <td><?php echo $result['fullname'] ?></td>
- <td><?php echo $result['depname'] ?></td>
- <td><?php echo $result['photo'] ?></td>
- </tr>
- <?php
- }
- ?>
- </table>
- <a href="index.php">
- <button type="submit">กลับไปหน้าแรก</button>
- </a>
- </div>
- <?php
- mysqli_close($conn);
- ?>
- </body>
- </html>
- -----------------------------------------
- addprocess.php
- <?php
- include "conf.php";
- $usr = $_POST['usr'];
- $pwd = $_POST['pwd'];
- $dep = $_POST['dep'];
- $fname = $_POST['fname'];
- $photo = $_POST['photo'];
- $sql = "INSERT INTO teacher VALUES(0,'$usr','$pwd','$fname','$dep','$photo')";
- $query = mysqli_query($conn,$sql);
- //$result = mysql_fetch_array($query);
- if($query){
- echo "เพิ่มข้อมูลเรียบร้อยแล้ว";
- echo "กรุณารอสักครู่...";
- header('refresh: 3; url=./index.php');
- }else{
- echo "ไม่สามารถเพิ่มข้อมูลได้";
- echo "กรุณารอสักครู่...";
- header('refresh: 3; url=./index.php');
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement