Gestionnaire de fichiers - Editer - /home/kridsana/webapp.cm.in.th/673190902/u67319090037/P001/index.php
Arrière
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>กรอกคะแนน</title> <style> body { font-family: Arial, sans-serif; background-color: #f0f8ff; display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; } .container { width: 70%; /* ปรับความกว้างให้แคบลง */ max-width: 750px; /* ลดความกว้างสูงสุดลง */ padding: 40px; /* ลด padding ลง */ border: 1px solid #ddd; border-radius: 15px; background-color: #ffffff; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); } .input-group { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 18px; } .input-group label { margin-bottom: 8px; font-size: 1.2em; color: #333; text-align: left; width: 100%; } .input-group input { width: 100%; padding: 12px; font-size: 1.2em; border: 1px solid #ccc; border-radius: 8px; box-sizing: border-box; } .result { margin-top: 20px; padding: 18px; border-top: 1px solid #ddd; font-size: 1.3em; text-align: center; } .result span { display: block; margin-bottom: 8px; font-weight: bold; } .button-group { display: flex; gap: 10px; } .calculate-btn, .reset-btn { width: 100%; padding: 16px; font-size: 1.3em; color: white; border: none; cursor: pointer; border-radius: 8px; transition: background-color 0.3s ease; } .calculate-btn { background-color: #4CAF50; } .calculate-btn:hover { background-color: #388e3c; } .reset-btn { background-color: #d9534f; } .reset-btn:hover { background-color: #c9302c; } h2 { text-align: center; font-size: 2em; /* ลดขนาดหัวข้อ */ color: #2c3e50; } .grade-A { color: green; } .grade-Bplus { color: blue; } .grade-B { color: navy; } .grade-Cplus { color: orange; } .grade-C { color: darkorange; } .grade-Dplus { color: orangered; } .grade-D { color: crimson; } .grade-F { color: red; } </style> </head> <body> <div class="container"> <h2>กรอกคะแนน</h2> <form action="" method="post"> <div class="input-group"> <label for="discipline">จิตพิสัย (20 คะแนน)</label> <input type="number" id="discipline" name="discipline" min="0" max="20" required> </div> <div class="input-group"> <label for="test">แบบทดสอบ (30 คะแนน)</label> <input type="number" id="test" name="test" min="0" max="30" required> </div> <div class="input-group"> <label for="work">งาน (20 คะแนน)</label> <input type="number" id="work" name="work" min="0" max="20" required> </div> <div class="input-group"> <label for="final_exam">สอบปลายภาค (30 คะแนน)</label> <input type="number" id="final_exam" name="final_exam" min="0" max="30" required> </div> <div class="button-group"> <button type="submit" class="calculate-btn">ประมวลผล</button> <button type="reset" class="reset-btn">รีเซ็ต</button> </div> </form> <?php if ($_SERVER["REQUEST_METHOD"] == "POST") { $discipline = $_POST['discipline']; $test = $_POST['test']; $work = $_POST['work']; $final_exam = $_POST['final_exam']; $total_score = $discipline + $test + $work + $final_exam; if ($total_score >= 80) { $grade = "A"; $grade_class = "grade-A"; } elseif ($total_score >= 75) { $grade = "B+"; $grade_class = "grade-Bplus"; } elseif ($total_score >= 70) { $grade = "B"; $grade_class = "grade-B"; } elseif ($total_score >= 65) { $grade = "C+"; $grade_class = "grade-Cplus"; } elseif ($total_score >= 60) { $grade = "C"; $grade_class = "grade-C"; } elseif ($total_score >= 55) { $grade = "D+"; $grade_class = "grade-Dplus"; } elseif ($total_score >= 50) { $grade = "D"; $grade_class = "grade-D"; } else { $grade = "F"; $grade_class = "grade-F"; } echo "<div class='result'>"; echo "<span>คะแนนรวม: $total_score คะแนน</span>"; echo "<span class='$grade_class'>เกรด: $grade</span>"; echo "</div>"; } ?> </div> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Génération de la page: 0.5 |
proxy
|
phpinfo
|
Réglages