Lưu trữ

Posts Tagged ‘Chương trình tính kết quả thi đại học [PHP(tt)]’

Chương trình tính kết quả thi đại học [PHP(tt)]

Nay Viet Matrix Revolutions hướng dẫn các bạn học lập trình PHP  1 số phần tiếp

Viết 1 ứng dụng tính điểm thi đại học

Yêu cầu :

1/ Tổng điểm lớn hơn điểm chuẩn và không có môn nào dưới 5 điểm ->Đậu

2/Tổng điểm nhỏ hơn điểm chuẩn ->Rớt

3/Tổng điểm lớn hơn điểm chuẩn , có 1 môn <5 ->Rớt

4/Ô kết quả và tổng điểm  không cho nhập liệu

Sau đây là ảnh kết quả do Viet Matrix Revolutions thực hiện

Kết quả thi đại học - Viet Matrix Revolutions

Kết quả thi đại học - Viet Matrix Revolutions

Và đây là code

==============

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Tính điểm đại học </title>
<style type=”text/css”>
<!–
.style1 {color: #FFFFFF}
.style3 {color: #FFFFFF; font-weight: bold; }
.style5 {color: #FF0000; font-weight: bold; }
–>
</style>
</head>

<body>
<?php
/*
Viet Matrix Revolutions
Anderson_neo – AlexBTP . . . and member Viet Matrix Revolutions
*/
if(isset($_POST[“toan”]) && isset($_POST[“ly”]) && isset($_POST[“hoa”]))
{
$toan=$_POST[“toan”];
$ly=$_POST[“ly”];
$hoa=$_POST[“hoa”];
$diem_chua=$_POST[“diem_chuan”];
$tong_diem=($toan+$ly)+$hoa;
$diem_chuan=$_POST[“diem_chuan”];
if($tong_diem>=$diem_chuan && $toan>=5 && $ly>=5 && $hoa>=5)
{
$ket_qua=”Đậu – Chúc mừng bạn “;

}
else
{
$ket_qua=”Rớt – Chia chia buồn “;
}
}

?>
<form id=”form1″ name=”form1″ method=”post” action=”tinhdiemdaihoc.php”>
<table width=”400″ border=”0″ align=”center” bgcolor=”#000000″>
<tr>
<td colspan=”2″ align=”center”><h1><span class=”style1″>Tính Điểm Đại Học </span></h1></td>
</tr>
<tr>
<td width=”137″><span class=”style3″>Toán</span></td>
<td width=”247″><label>
<input name=”toan” type=”text” id=”toan” value=”<?php echo $_POST[“toan”];?>” />
</label></td>
</tr>
<tr>
<td><span class=”style3″>Lý</span></td>
<td><label>
<input name=”ly” type=”text” id=”ly” value=”<?php echo $_POST[“ly”];?>” />
</label></td>
</tr>
<tr>
<td><span class=”style3″>Hóa</span></td>
<td><label>
<input name=”hoa” type=”text” id=”hoa” value=”<?php echo $_POST[“hoa”];?>” />
</label></td>
</tr>
<tr>
<td><span class=”style3″>Điểm Chuẩn </span></td>
<td><label>
<input name=”diem_chuan” type=”text” id=”diem_chuan” value=”<?php echo $diem_chuan;?>” />
</label></td>
</tr>
<tr>
<td><span class=”style3″>Tổng Điểm </span></td>
<td><label>
<input name=”tong_diem” type=”text” id=”tong_diem” value=”<?php echo $tong_diem?>” readonly=”true” style=”background-color:#FFCCFF” />
</label></td>
</tr>
<tr>
<td><span class=”style3″>Kết Quả Thi </span></td>
<td><label>
<input name=”ket_qua” type=”text” id=”ket_qua”
style=”background-color:#FFCCFF” value=”<?php echo $ket_qua;?>” size=”40″ readonly=”true”/>
</label></td>
</tr>
<tr>
<td colspan=”2″ align=”right”><label>
<input type=”submit” name=”Submit” value=”Tính” />
<span class=”style5″>Viet Matrix Revolutions </span></label></td>
</tr>
</table>
</form>
</body>
</html>

==============

Toàn quyền thuộc về Viet Matrix Revolutions – Ghi rõ nguồn khi sử dụng thông tin này qua 1 nơi khác

Anderson_neo – AlexBTP and member Viet Matrix Revolutions