웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
교육용 방명록 #2 [글쓰기 폼 작성]
2000.07.03 02:52
6 Step. 글쓰기 폼 파일을 만들어 봅시다.
write.php3 파일내용
1 <?
2 include "lib.php3";
3 include "dbconn.php3";
4
5 // 쿠키값을 가져옴
6 $cookie_writer=$HTTP_COOKIE_VARS[cookie_writer];
7 $cookie_homepage=$HTTP_COOKIE_VARS[cookie_homepage];
8 $cookie_email=$HTTP_COOKIE_VARS[cookie_email];
9
10 include "head.php3";
11 ?>
12
13 <form type=post action=write_ok.php3>
14
15 <div align=center>
16
17 <table border=1 width=450 cellspacing=0 cellpadding=2>
18 <tr>
19 <td align=center colspan=2>글쓰기</td>
20 </tr>
21 <tr>
22 <td align=center width=100>비밀번호</td>
23 <td><input type=password name=password size=20 maxlength=20></td>
24 </tr>
25 <tr>
26 <td align=center>이 름</td>
27 <td><input type=text name=writer value='<? echo $cookie_writer; ?>' size=12 maxlength=12></td>
28 </tr>
29 <tr>
30 <td align=center>홈페이지</td>
31 <td><input type=text name=homepage value='<? echo $cookie_homepage; ?>' size=40 maxlength=80></td>
32 </tr>
33 <tr>
34 <td align=center>E-MAIL</td>
35 <td><input type=text name=email value='<? echo $cookie_email; ?>' size=40 maxlength=80></td>
36 </tr>
37 <tr>
38 <td colspan=2 align=right>
39 <input type=checkbox name=use_html checked> HTML 사용
40 <input type=checkbox name=use_cookie checked> 쿠키저장
41 </td>
42 </tr>
43 <tr>
44 <td align=center colspan=2><textarea name=comment cols=50 rows=8></textarea></td>
45 </tr>
46 <tr>
47 <td align=center colspan=2>
48 <input type=submit value='입력완료'>
49 <input type=reset value='다시쓰기'>
50 <input type=button value='목록보기' onclick=self.location.href='list.php3'>
51 </td>
52 </tr>
53 </table>
54
55 </form>
56
57 <?
58 include "foot.html";
59 ?>
내용설명
1~11 : 각종 파일의 include와 변수 정의 부분입니다.
2: lib.php3 파일을 include 합니다.
3: MySQL DB에 연결하는 dbconn.php3 파일을 include 합니다.
5~7 : 글쓴이, 홈페이지, E-MAIL에 대한 값을 쿠키 환경변수에서 가져 옵니다.
만약 이전에 쿠키지정이 되어 있지 않았다면 빈값이 입력됩니다.
10 : 브라우저에 출력하기 전에 header를 출력합니다.
13~55 : 각종 입력받을 값에 대한 form 문입니다.
13 : <form type=post action=write_ok.php3>
form 문의 type을 post로 정하고 변수값이 넘겨질 파일(action)을 write_ok.php3 파일로 지정합니다.
23: <input type=password name=password size=20 maxlength=20>
비밀번호가 입력될 input 문의 이름을 password로 지정합니다.
24 : <input type=text name=writer value='<? echo $cookie_writer; ?>' size=12 maxlength=12>
글쓴이의 이름이 입력될 input 문의 이름을 writer로 지정하고 초기값을 위에서 얻어온 쿠키값을 넣습니다.
만약 쿠키가 지정되지 않았다면 아무런 값도 들어가지 않습니다.
31 : <input type=text name=homepage value='<? echo $cookie_homepage; ?>' size=40 maxlength=80>
홈페이지가 입력될 input문입니다.
35 : <input type=text name=email value='<? echo $cookie_email; ?>' size=40 maxlength=80>
E-Mail 주소가 입력될 input 문입니다.
39 : <input type=checkbox name=use_html checked> HTML 사용
HTMl을 사용할것인지에 대한 체크박스입니다. 기본적으로 사용한다고 체크되어 있습니다.
40 : <input type=checkbox name=use_cookie checked> 쿠키저장
이름, 홈페이지주소, 메일주소를 쿠키로 저장할것인지에 대한 체크박스입니다.
48~49 : <input type=submit value='입력완료'>
<input type=reset value='다시쓰기'>
submit과 reset 버튼입니다.
50 : <input type=button value='목록보기' onclick=self.location.href='list.php3'>
만약 글쓰기를 하지 않고 목록보기를 원할시 클릭하면 list.php3 파일로 이동하게 합니다.
58 : include "foot.html";
footer 파일을 출력합니다.
write.php3 파일내용
1 <?
2 include "lib.php3";
3 include "dbconn.php3";
4
5 // 쿠키값을 가져옴
6 $cookie_writer=$HTTP_COOKIE_VARS[cookie_writer];
7 $cookie_homepage=$HTTP_COOKIE_VARS[cookie_homepage];
8 $cookie_email=$HTTP_COOKIE_VARS[cookie_email];
9
10 include "head.php3";
11 ?>
12
13 <form type=post action=write_ok.php3>
14
15 <div align=center>
16
17 <table border=1 width=450 cellspacing=0 cellpadding=2>
18 <tr>
19 <td align=center colspan=2>글쓰기</td>
20 </tr>
21 <tr>
22 <td align=center width=100>비밀번호</td>
23 <td><input type=password name=password size=20 maxlength=20></td>
24 </tr>
25 <tr>
26 <td align=center>이 름</td>
27 <td><input type=text name=writer value='<? echo $cookie_writer; ?>' size=12 maxlength=12></td>
28 </tr>
29 <tr>
30 <td align=center>홈페이지</td>
31 <td><input type=text name=homepage value='<? echo $cookie_homepage; ?>' size=40 maxlength=80></td>
32 </tr>
33 <tr>
34 <td align=center>E-MAIL</td>
35 <td><input type=text name=email value='<? echo $cookie_email; ?>' size=40 maxlength=80></td>
36 </tr>
37 <tr>
38 <td colspan=2 align=right>
39 <input type=checkbox name=use_html checked> HTML 사용
40 <input type=checkbox name=use_cookie checked> 쿠키저장
41 </td>
42 </tr>
43 <tr>
44 <td align=center colspan=2><textarea name=comment cols=50 rows=8></textarea></td>
45 </tr>
46 <tr>
47 <td align=center colspan=2>
48 <input type=submit value='입력완료'>
49 <input type=reset value='다시쓰기'>
50 <input type=button value='목록보기' onclick=self.location.href='list.php3'>
51 </td>
52 </tr>
53 </table>
54
55 </form>
56
57 <?
58 include "foot.html";
59 ?>
내용설명
1~11 : 각종 파일의 include와 변수 정의 부분입니다.
2: lib.php3 파일을 include 합니다.
3: MySQL DB에 연결하는 dbconn.php3 파일을 include 합니다.
5~7 : 글쓴이, 홈페이지, E-MAIL에 대한 값을 쿠키 환경변수에서 가져 옵니다.
만약 이전에 쿠키지정이 되어 있지 않았다면 빈값이 입력됩니다.
10 : 브라우저에 출력하기 전에 header를 출력합니다.
13~55 : 각종 입력받을 값에 대한 form 문입니다.
13 : <form type=post action=write_ok.php3>
form 문의 type을 post로 정하고 변수값이 넘겨질 파일(action)을 write_ok.php3 파일로 지정합니다.
23: <input type=password name=password size=20 maxlength=20>
비밀번호가 입력될 input 문의 이름을 password로 지정합니다.
24 : <input type=text name=writer value='<? echo $cookie_writer; ?>' size=12 maxlength=12>
글쓴이의 이름이 입력될 input 문의 이름을 writer로 지정하고 초기값을 위에서 얻어온 쿠키값을 넣습니다.
만약 쿠키가 지정되지 않았다면 아무런 값도 들어가지 않습니다.
31 : <input type=text name=homepage value='<? echo $cookie_homepage; ?>' size=40 maxlength=80>
홈페이지가 입력될 input문입니다.
35 : <input type=text name=email value='<? echo $cookie_email; ?>' size=40 maxlength=80>
E-Mail 주소가 입력될 input 문입니다.
39 : <input type=checkbox name=use_html checked> HTML 사용
HTMl을 사용할것인지에 대한 체크박스입니다. 기본적으로 사용한다고 체크되어 있습니다.
40 : <input type=checkbox name=use_cookie checked> 쿠키저장
이름, 홈페이지주소, 메일주소를 쿠키로 저장할것인지에 대한 체크박스입니다.
48~49 : <input type=submit value='입력완료'>
<input type=reset value='다시쓰기'>
submit과 reset 버튼입니다.
50 : <input type=button value='목록보기' onclick=self.location.href='list.php3'>
만약 글쓰기를 하지 않고 목록보기를 원할시 클릭하면 list.php3 파일로 이동하게 합니다.
58 : include "foot.html";
footer 파일을 출력합니다.
댓글 11
-
킹초보
2000.12.30 22:57
head.php3랑foot.php는 어케만드나여? -
정우성
2001.01.13 11:36
head.php3랑 foot.php3없이도 프로그램 돌아가나여 -
tagnet
2001.02.14 13:59
움.. 꼭 쿠키라는 넘을 이용해야 하는지여..?? 궁금해서여 -
신지현
2001.04.22 11:05
먼말이야... -
red1004h
2001.04.25 15:04
2단계 공부를 하고있고만...지금...^-^+ 이해는 대충가지만. -
조현갑
2001.06.27 15:22
head.php랑 foot.html은 빈화일로 만들면 되네염... -
황도근
2001.07.05 21:49
커멘트가 확실히 줄었네... ㅋㅋ... -
박호림
2001.07.07 11:00
소스는 다운 받을 수 없나요? 쩝... -
밍이
2002.03.12 15:07
쿠키...쿠키...
이녀석을 써야한단말이죠?
이녀석 한몫 하고 있네요....
+_+ 초보지만 대충 이해는 된것 같아요. -
소용돌이
2002.04.22 06:49
이부분은 이해했어여..ㅠ.ㅠ 웃~ 땡큐 -
하라주크
2007.07.30 18:05
쿠키는 다른사이트에 정보를넘기는걸로암...
아뭇흔 클리워!!!!
제목 | 글쓴이 | 날짜 |
---|---|---|
4. 디렉토리 관련함수 [1] | 한꼬마 | 2002.10.04 |
3. URL 관련 함수 [1] | 한꼬마 | 2002.10.04 |
2. MYSQL 관련 함수 [2] | 한꼬마 | 2002.10.04 |
1. 데이터베이스 질의어(SQL) 다루기 [4] | 한꼬마 | 2002.10.04 |
[PHP...쿠키편] 4강: 쿠키 실전 프로그래밍 - 2 / 2 [3] | TheMics | 2002.09.23 |
[PHP...쿠키편] 4강: 쿠키 실전 프로그래밍 - 1 / 2 [2] | TheMics | 2002.09.23 |
[PHP 초보에서 중수로 - 쿠키편] 3강 : 쿠키 실전 사용 | TheMics | 2002.09.21 |
[추천 강의] 플래시로 보는 노프레임 홈 만들기! [63] | ROBIN | 2002.09.18 |
초보의 절대경로 알아내기.. #2 [6] | 아이쿠 | 2002.09.17 |
초보의 절대경로 알아내기.. #1 | 아이쿠 | 2002.09.17 |
개인 서버 운영하시는분 서버 꺼졌을때 메시지 띄우기; [12] | 실버 | 2002.09.11 |
전에 올렸던 게시판입니다. JHboard 게시판 중도 포기작품..!; [5] | Myzzix | 2002.09.09 |
디렉토리의 내용을 가져오는 방법 [2] | DHelper | 2002.09.02 |
[php] 스킨 해석&출력... [2] | 엔카일 | 2002.09.01 |
[추천 팁] 오에카키 PHP 버전으로 만들기 [19] | 소프트맨 | 2002.08.31 |
[PHP 초보에서 중수로 - 쿠키편] 2강 : 쿠키 다루기 [3] | TheMics | 2002.08.31 |
[PHP 초보에서 중수로 - 쿠키편] 1강 : 쿠키의 이해 [2] | TheMics | 2002.08.31 |
초보의 php를 활용한 OneFrame(NoFrame) 홈페이지 만들기 - 4 end [15] | 아이쿠 | 2002.08.30 |
초보의 php를 활용한 OneFrame(NoFrame) 홈페이지 만들기 - 3 [1] | 아이쿠 | 2002.08.30 |
초보의 php를 활용한 OneFrame(NoFrame) 홈페이지 만들기 - 2 [11] | 아이쿠 | 2002.08.30 |