Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- autoset
- 버추얼머신
- 네트워크관리사
- 이것이 자바다
- 네트워크
- 데이터베이스
- 참조타입
- sql
- html
- rinux
- jsp
- 정처기필기
- w3school
- 라우터
- ospf
- 오라클
- VLAN
- javaee
- jsp연결
- 원형그래프
- 정보처리기사
- Cisco
- NCS
- ciscopacket
- 자바
- cisco packet
- Java
- Oracle
- 리눅스
- php
Archives
- Today
- Total
기록해! 정리해!
HTML -- 성적조회 프로그램 Ver1.0 (1) 코드정리 본문
2022.06.20 - [Visual studio] - HTML -- 성적조회 프로그램 Ver1.0 (1)
index.php
<? include "top.php"?>
<section>
<br>
<div id="section1">
고등학교 성적 조회 프로그램 <br>
</div>
<br>
 <b>고등학교 성적을 조회하는 프로그램을 작성한다.</b>
<ol>
<li> 학생 성적 정보 테이블을 생성한다. <br>
<li> 학생 성적 테이블에 샘플데이터를 SQL문을 이용하여 추가한다. <br>
<li> 주어진 화면 디자인을 이용하여 화면을 디자인한다. <br>
<li> 업무 여건에 따라 프로그램을 작성한다. <br>
</ol>
</section>
<? include "bottom.php"?>
top.php
<html>
<head>
<title> 정보처리기능사 연습 </title>
<style>
header{
background-color:blue;
height:80px;
line-height:80px;
color:#ffffff;
font-size:28px;
text-align:center;
}
nav{
background-color:#00aaff;
height:30px;
line-height:30px;
color:#ffffff;
font-size:14px;
}
section{
background-color:#cccccc;
min-height:650px;
}
footer{
background-color:#0033ff;
height: 40px;
line-height:40px;
color:#ffffff;
text-align:center;
font-size: 17px;
}
#section1{
text-align:center;
font-size:25px;
}
#body{
width:80%;
margin:auto;
}
</style>
</head>
<body>
<div id="body">
<header> (과정평가형 정보처리기능사)성적조회 프로그램 Ver1.0 </header>
<nav>
  <a href=form.php>성적입력</a>
 <a href=list.php>성적조회</a>
 <a href=member.php>회원가입</a>
 <a href=member_list.php>회원조회</a>
 <a href=index.php>홈으로</a>
</nav>
bottom.php
<footer>
HRDKOREA Copyrightⓒ2018 ALL rights reserved. Human Resources Development Services of Korea
</footer>
</div>
</body>
</html>
DBconn.php
<?
$conn = new mysqli("localhost","root","autoset","korea");
?>
form.php
<? include "top.php"?>
<style>
table{
width:350px;
height: 300px;
}
td{
text-align:center;
}
</style>
<script>
function ck1(){
if(f1.sno.value == ""){
alert("학번을 입력해 주세요");
f1.sno.focus();
return false;
}else{
alert("학생 성적이 입력 되었습니다.");
}
}
</script>
<section>
<br><br>
<div id="section1">
학생 성적 입력 <br>
</div>
<br>
<div align=center>
<form name=f1 action=form_ok.php onSubmit="return ck1()" method=get>
<table border=1>
<tr><td>학 번</td> <td><input type=text name=sno></td></tr>
<tr><td>이 름</td> <td><input type=text name=sname></td></tr>
<tr><td>국 어</td> <td><input type=text name=kor></td></tr>
<tr><td>영 어</td> <td><input type=text name=eng></td></tr>
<tr><td>수 학</td> <td><input type=text name=math></td></tr>
<tr><td>역 사</td> <td><input type=text name=hist></td></tr>
<tr><td colspan=2 align=center><input type=submit value="성적저장"> </td></tr>
</table>
</form>
</div>
</section>
<? include "bottom.php"?>
form_ok.php
<? include "DBconn.php" ?>
<?
$sno = $_GET['sno'];
$sname = $_GET['sname'];
$kor = $_GET['kor'];
$eng = $_GET['eng'];
$math = $_GET['math'];
$hist = $_GET['hist'];
$SQL = "insert into examtbl (sno, sname, kor, eng, math, hist) " ;
$SQL = $SQL . " values ('$sno', '$sname, '$kor', '$eng', '$math', '$hist') " ;
$conn -> query($SQL);
?>
<script>
location.href="list.php" ;
</script>
edit.php
<? include "top.php" ?>
<? include "DBConn.php" ?>
<?
$sno=$_GET['sno'];
$ch1=$_GET['ch1'];
$ch2=$_GET['ch2'];
$SQL = " select * from examtbl where sno=$sno ";
$result = $conn -> query($SQL);
$row = $result ->fetch_assoc();
?>
<style>
table{
width: 350px ;
height:300px ;
}
td{
text-align:center;
}
</style>
<script>
function ck1(){
if (f1.sno.value == "") {
alert("학번을 입력해 주세요");
f1.sno.focus();
return false;
}else{
alert("학생 성적이 입력 되었습니다.");
}
}
function ck2(sno, ch1, ch2){
location.href="delete.php?sno="+sno+"&ch1="+ch1+"&ch2="+ch2;
}
</script>
<section>
<br><br>
<div id=section1>
학생성적수정하기
</div>
<br>
<div align=center>
<form name=f1 action=update_ok.php onSubmit="return ck1()" method=get >
<input type=hidden name=ch1 value="<?=$ch1?>" >
<input type=hidden name=ch2 value="<?=$ch2?>" >
<table border=1>
<tr><td>학 번</td><td><input type=text name=sno value="<?=$row['sno']?>" > </td></tr>
<tr><td>이 름</td><td> <input type=text name=sname value="<?=$row['sname']?>" ></td></tr>
<tr><td>국 어</td><td> <input type=text name=kor value="<?=$row['kor']?>" ></td></tr>
<tr><td>영 어</td><td> <input type=text name=eng value="<?=$row['eng']?>" ></td></tr>
<tr><td>수 학</td><td> <input type=text name=math value="<?=$row['math']?>" ></td></tr>
<tr><td>역 사</td><td> <input type=text name=hist value="<?=$row['hist']?>" ></td></tr>
<tr><td colspan=2 align=center><input type=submit value="수정하기" >
<input type=button value="삭제하기" onClick="ck2('<?=$sno?>','<?=$ch1?>','<?=$ch2?>')" >
</td></tr>
</table>
</form>
</div>
</section>
<? include "bottom.php" ?>
update_ok.php
<? include "DBconn.php" ?>
<?
$ch1 = $_GET['ch1'];
$ch2 = $_GET['ch2'];
$sno = $_GET['sno'];
$sname = $_GET['sname'];
$kor = $_GET['kor'];
$eng = $_GET['eng'];
$math = $_GET['math'];
$hist = $_GET['hist'];
$SQL = "update examtbl set sno='$sno',
kor='$kor', eng='$eng',
math='$math', hist='$hist' " ;
$SQL = $SQL . "where sno='$sno'" ;
$conn -> query($SQL);
?>
<script>
location.href="list.php?&ch1=<?=$ch1?>&ch2=<?=$ch2?>" ;
</script>
delete.php
<? include "DBConn.php" ?>
<?
$sno = $_GET['sno'];
$ch1 = $_GET['ch1'];
$ch2 = $_GET['ch2'];
$SQL ="delete from examtbl where sno ='$sno' " ;
$conn -> query($SQL);
?>
<script>
location.href="list.php?ch1=<?=$ch1?>&ch2=<?=$ch2?>" ;
</script>
member.php
<? include "top.php" ?>
<style>
table{
width: 350px ;
height:300px ;
}
td{
text-align:center;
}
</style>
<script>
function ck1(){
if (f1.sno.value == "") {
alert("학번을 입력해 주세요");
f1.sno.focus();
return false;
}else{
alert("학생 성적이 입력 되었습니다.");
}
}
</script>
<section>
<br><br>
<div id=section1>
학생 정보 입력
</div>
<br>
<div align=center>
<form name=f1 action=member_ok.php
onSubmit="return ck1()" method=post
enctype="multipart/form-data" >
<table border=1>
<tr><td>학 번</td><td><input type=text name=sno > </td></tr>
<tr><td>주소</td><td> <input type=text name=addr ></td></tr>
<tr><td>사진</td><td> <input type=file name=img ></td></tr>
<tr><td colspan=2 align=center><input type=submit value="회원가입" ></td></tr>
</table>
</form>
</div>
</section>
<? include "bottom.php" ?>
member_ok.php
<? include "DBConn.php" ?>
<?
$sno = $_REQUEST['sno'];
$addr = $_REQUEST['addr'];
$mfile = $_FILES['img']['name'];
$tmp = $_FILES['img']['tmp_name'];
if ( $mfile =="") {
$mfile='space.jpg' ;
} else {
if(file_exists("./img/$mfile")) {
$f_fname = basename($mfile, strrchr($mfile,"."));
$randomNum = date("His",time());
$fileinfo = pathinfo($mfile);
$ext = $fileinfo['extension'];
$mfile = $f_fname."_".$randomNum.".".$ext;
move_uploaded_file($tmp, "./img/$mfile");
} else{
move_uploaded_file($tmp, "./img/$mfile");
}
}
$SQL ="insert into member (sno, addr, img) " ;
$SQL = $SQL . " values ('$sno','$addr' ,'$mfile')" ;
$conn -> query($SQL);
?>
<script>
location.href="list.php" ;
</script>
member_list.php
<? include "top.php" ?>
<? include "DBConn.php" ?>
<?
$SQL = "select * from member " ;
$result = $conn -> query($SQL);
?>
<style>
table{
width: 500px ;
}
td{
text-align:center;
height: 25px ;
}
</style>
<section>
<br>
<div id=section1>
성적조회목록
</div>
<br>
<div align=center>
<table border=1>
<tr> <td>학번</td> <td>주소</td><td>파일명</td><td>사진</td>
</tr>
<?
while( $row = $result ->fetch_assoc() ) {
?>
<tr> <td><?=$row['sno']?></td>
<td><?=$row['addr']?></td>
<td><?=$row['img']?> </td>
<td><img src=./img/<?=$row['img']?> width=50 height=50> </td>
</tr>
<? } ?>
</table>
</div>
</section>
<? include "bottom.php" ?>
'Visual studio (PHP)' 카테고리의 다른 글
HTML --성적조회 프로그램Ver 1.0 (2) 코드정리 (0) | 2022.06.22 |
---|---|
HTML --성적조회 프로그램Ver 1.0 (2) (0) | 2022.06.21 |
HTML -- 성적조회 프로그램 Ver1.0 (1) (0) | 2022.06.20 |
HTML -- 학생 성적처리 ver 11 코드정리 (0) | 2022.06.20 |
HTML --폼 태그 (0) | 2022.06.17 |
Comments