* Login   * Register


Last visit was:
It is currently Mon Jun 18, 2018 4:06 pm
View unanswered posts
View active topics





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: THÊM THÔNG TIN SINH VIÊN
PostPosted: Tue Jun 02, 2009 11:54 pm 
Offline

Joined: Sun Feb 08, 2009 11:00 pm
Posts: 29
---------
THEMSV.PHP
<?php
session_start();
require("chksession.php");
?>
<?php
include('ketnoi.php');
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
font-size: 24px;
font-weight: bold;
color: #3333CC;
}
.style11 {font-size: 16px; font-weight: bold; color: #3333CC; }
.style12 {color: #3333CC; font-size: 16px;}
-->
</style>
</head>


<form id="form1" name="sinhvien" method="post" action="xlthemsv.php" onsubmit="return kiemtra();">
<script language="javascript">
function kiemtra()
{
if(document.sinhvien.txtMaSV.value=='')
{
alert(" vui long nhap vao ma sinh vien");
document.sinhvien.txtMaSV.focus();
return false;
}
if(document.sinhvien.txtTenSV.value=='')
{
alert(" vui long nhap vao ten sinh vien");
document.sinhvien.txtTenSV.focus();
return false;
}
if(document.sinhvien.txtGioiTinh.value=='')
{
alert(" vui long nhap vao gioi tinh");
document.sinhvien.txtGioiTinh.focus();
return false;
}
if(document.sinhvien.txtNamSinh.value=='')
{
alert(" vui long nhap vao nam sinh cua sinh vien");
document.sinhvien.txtNamSinh.focus();
return false;
}
if(document.sinhvien.txtMaLop.value=='')
{
alert(" vui long nhap vao ma lop");
document.sinhvien.txtMaLop.focus();
return false;
}
if(document.sinhvien.txtMaKhoa.value=='')
{
alert(" vui long nhap vao ma khoa hoc");
document.sinhvien.txtMaKhoa.focus();
return false;
}
if(document.sinhvien.txtNoiSinhvalue=='')
{
alert(" vui long nhap vao noi sinh cua sinh vien");
document.sinhvien.txtNoiSinh.focus();
return false;
}
}
</script>
<table width="787" border="0" align="center">

<tr>
<td height="70" colspan="2"><div align="center" class="style1">NH&#7852;P TH&Ocirc;NG TIN SINH VI&Ecirc;N </div></td>
</tr>
<tr>
<td width="188" height="50"><span class="style11">M&atilde; Sinh Vi&ecirc;n: </span></td>
<td width="308"><label>
<input name="txtMaSV" type="text" id="txtMaSV" size="45" />
</label></td>
</tr>
<tr>
<td width="188" height="50"><span class="style11">T&ecirc;n Sinh Vi&ecirc;n: </span></td>
<td width="308"><label>
<input name="txtTenSV" type="text" id="txtTenSV" size="45" />
</label></td>
</tr>
<tr>
<td height="46"><span class="style11">Gi&#7899;i T&iacute;nh </span></td>
<td><label>
<input name="txtGioiTinh" type="text" id="txtGioiTinh" size="45" />
</label></td>
</tr>
<tr>
<td height="48"><span class="style11">N&#259;m Sinh: </span></td>
<td><label>
<input name="txtNamSinh" type="text" id="txtNamSinh" size="45" />
</label></td>
</tr>
<tr>
<td height="48"><span class="style11">M&atilde; L&#7899;p: </span></td>
<td><label>
<input name="txtMaLop" type="text" id="txtMaLop" size="45" />
</label></td>
</tr>
<tr>
<td height="48"><span class="style11">M&atilde; Kh&oacute;a: </span></td>
<td><label>
<input name="txtMaKhoa" type="text" id="txtMaKhoa" size="45" />
</label></td>
</tr>
<tr>
<td height="48"><span class="style11">N&#417;i Sinh: </span></td>
<td><label>
<input name="txtnoiSinh" type="text" id="txtNoiSinh" size="45" />
</label></td>
</tr>
<tr>
<td height="48">&nbsp;</td>
<td><label>
<input name="Save" type="submit" class="style11" id="Save" value="Save" />
<input name="cancle" type="submit" class="style11" id="cancle" value="Cancle" />
</label></td>
</tr>
</table>
<div align="center">
<table width="785" height="168" border="1">
<tr>
<td height="44" colspan="10"><div align="center" class="style1"><strong>TH&Ocirc;NG TIN &#272;&Atilde; NH&#7852;P </strong></div></td>
</tr>

<tr>
<td width="42" height="45" class="style11">&nbsp;</td>
<td width="41" class="style11">&nbsp;</td>
<td width="98" class="style11" ><strong>M&Atilde; SINH VI&Ecirc;N </strong></td>
<td width="170" class="style11" ><strong>T&Ecirc;N SINH VI&Ecirc;N </strong></td>
<td width="66" class="style11"><strong>GI&#7898;I T&Iacute;NH </strong></td>
<td width="68" class="style11">N&#258;M SINH </td>
<td width="61" class="style11">M&Atilde; L&#7898;P </td>
<td width="82" class="style11">M&Atilde; KH&Oacute;A </td>
<td width="99" class="style11">N&#416;I SINH </td>
</tr>
<?php
$sql="SELECT * FROM sinhvien";
$kq=mysql_query($sql,$link);
?>
<?php
if(mysql_num_rows($kq)!=0)
{
while($row=mysql_fetch_array($kq))
{
$id=$row["MaSV"];
$TenSV=$row["TenSV"];
$GioiTinh=$row["GioiTinh"];
$NamSinh=$row["NamSinh"];
$MaLop=$row["MaLop"];
$MaKhoa=$row["MaKhoa"];
$NoiSinh=$row["NoiSinh"];


?>
<tr>
<td height="33" class="style11"><div align="center"><a href="xoasv.php?id=<?=$id?>">X&Oacute;A</a></div></td>
<td class="style11"><div align="center"><a href="suasv.php?id=<?=$id?>">S&#7916;A</a></div></td>
<td><?php echo $id;?> </td>
<td><?php echo $TenSV;?> </td>
<td><?php echo $GioiTinh;?></td>
<td><?php echo $NamSinh;?></td>
<td><?php echo $MaLop;?> </td>
<td><?php echo $MaKhoa;?></td>
<td><?php echo $NoiSinh;?></td>
</tr>
<?php
}
}
?>

</table>
</div>
</form>
</body>
</html>
XỬ LÍ THÊM:

<?php
include('ketnoi.php');
$MaMon=$_POST['txtMaMon'];
$MaSV=$_POST['txtMaSV'];
$Diem=$_POST['txtDiem'];
$ThiLai=$_POST['txtThiLai'];
$HocLai=$_POST['txtHocLai'];

$sql="insert into lop(MaMon,MaSV,Diem,ThiLai,HocLai)";
$sql.=" values('$MaMon','$MaSV','$Diem','$ThiLai','HocLai')";
$kq=mysql_query($sql,$link);

if($kq)
{
echo"<script> alert('Them thanh cong');</script>";
}
else
{
echo"<script> alert('Them khong thanh cong, Xin vui long thu lai');</script>";
}
echo'<meta http-equiv="REFRESH" content="0;URL=themdiemsv.php"/>';
?>


Report this post
Top
 Profile E-mail  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 


Who is online

Users browsing this forum: No registered users and 0 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Create Forum · php-BB© · Internationalization Project · Report abuse · Terms Of Use/Privacy Policy
© Forums-Free.com 2009