File manager - Edit - /home/kridsana/webapp.cm.in.th/663012801/u66301280005/P001/P001.php
Back
<!DOCTYPE html> <html lang="th"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>การคำนวณคะแนนและเกรด</title> <style> * { box-sizing: border-box; } body { font-family: 'Arial', sans-serif; background-color: #f9f9f9; margin: 0; padding: 0; display: flex; justify-content: center; align-items: center; min-height: 100vh; } .container { background-color: #ffffff; width: 90%; max-width: 600px; padding: 25px; border-radius: 10px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); } h1 { text-align: center; color: #2c3e50; } .input-group { margin: 15px 0; display: flex; justify-content: space-between; align-items: center; } .input-group label { flex: 1; font-size: 16px; color: #333; } .input-group input { flex: 2; padding: 10px; font-size: 16px; border: 1px solid #ddd; border-radius: 5px; } .button-container { text-align: center; margin-top: 20px; } button { background-color: #3498db; color: white; border: none; padding: 12px 20px; font-size: 16px; border-radius: 5px; cursor: pointer; } button:hover { background-color: #2980b9; } .result { margin-top: 20px; text-align: center; font-size: 18px; } table { width: 100%; border-collapse: collapse; margin-top: 20px; } th, td { padding: 10px; text-align: center; border: 1px solid #ddd; } th { background-color: #3498db; color: white; } </style> </head> <body> <div class="container"> <h1>กรอกคะแนนและคำนวณเกรด</h1> <form method="post"> <div class="input-group"> <label>จิตพิสัย:</label> <input type="number" name="participation" placeholder="กรอกคะแนน" required min="0" max="100"> </div> <div class="input-group"> <label>งาน:</label> <input type="number" name="assignment" placeholder="กรอกคะแนน" required min="0" max="100"> </div> <div class="input-group"> <label>สอบกลางภาค:</label> <input type="number" name="midterm" placeholder="กรอกคะแนน" required min="0" max="100"> </div> <div class="input-group"> <label>สอบปลายภาค:</label> <input type="number" name="final" placeholder="กรอกคะแนน" required min="0" max="100"> </div> <div class="button-container"> <button type="submit">คำนวณคะแนน</button> </div> </form> <?php if ($_SERVER["REQUEST_METHOD"] == "POST") { $participation = $_POST["participation"]; $assignment = $_POST["assignment"]; $midterm = $_POST["midterm"]; $final = $_POST["final"]; $totalScore = $participation + $assignment + $midterm + $final; function calculateGrade($score) { if ($score >= 80) return "A"; if ($score >= 75) return "B+"; if ($score >= 70) return "B"; if ($score >= 65) return "C+"; if ($score >= 60) return "C"; if ($score >= 55) return "D+"; if ($score >= 50) return "D"; return "F"; } $grade = calculateGrade($totalScore); echo "<div class='result'>"; echo "<p>คะแนนรวม: $totalScore</p>"; echo "<p>เกรดที่ได้: $grade</p>"; echo "</div>"; } ?> </div> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 3.94 |
proxy
|
phpinfo
|
Settings