조회 : 183
이부분은 제가 자주 혼동됩니다.
자바스크립트와 PHP를 넘나들며 문법을 써먹어야하니
어서 빨리 습관을 들여야하겠습니다.
이부분은 아래 동 입력하지 않거나 검색을 잘못하였을때
조언을 받아서 자바스크립트에 히스토리 백으로 처리했습니다.
아래 소스는 잘돌아가고 있습니다
그리고
cube.jisman.co.kr/~ihkim 에 들어가보시면
제가 지금 하고 있는 폴더가 online부분 입니다.
그부분에 Newrecruit1,2,3 Html, php 이부분입니다.
아래 소스는 zipsearch.html 이부분입니다.
<?
if(!$mode) {
?>
<html>
<head>
<title>우편번호검색</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<link rel="stylesheet" href="../type.css" type="text/css">
<style type="text/css">
<!--        /* 전체 Body, TD 에 폰트 사이즈와 글자체 위치 설정 */                 
body, td {font-size:9pt; font-family:굴림; padding:5px 0px 5px 10px;}
-->
</style>
</head>
<body onload="document.zipsearch.dong.focus();">
<form name=zipsearch method="post"   action="zipsearch.php?type=<?echo $type?> &mode=search">
<table align=center>
 <tr>
  <td align=center>
   <b>우펀번호 검색</b>
  </td>
 </tr>
 <tr>
  <td>
   <table align=center height=100>
    <tr>
     <td align=center>현재 거주하고 계시는 읍/면/동/리 명을 입력하세요</td>
    </tr>
     <td align=center>
      <input type=text name=dong size=16 class=input> 
      <input type=submit value="검색" align="absmiddle">
     <td>
    </tr>
   </table>
  </td>
 </tr>
</table>
</form>
</body>
</html>
<?
} 
 else if($mode == "search")
 {
  if(!$dong)
  {
   echo"<script>alert('동을 입력하세요');  history.back();</script>"; 
  }
?>
<html>
<head>
<title>우편번호검색</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<link rel="stylesheet" href="../type.css" type="text/css">
<style type="text/css">
<!--        /* 전체 Body, TD 에 폰트 사이즈와 글자체 위치 설정 */                 
body, td {font-size:9pt; font-family:굴림; padding:5px 0px 5px 10px;}
-->
</style>
</head>
<body onload="document.zipsearch2.addr.focus();">
<form name=zipsearch2 method="post" action="zipsearch.php?type=<?echo $type?> &mode=input">
<table align=center>
 <tr>
  <td align=center>
   <b>우편번호 검색</b>
  </td>
 </tr>
 <tr>
  <td>
   <table align=center height=100>
    <tr>
     <td align=center>
      주소를 선택해 주세요
      </td>
     </tr>
     <tr>
      <td align=center>
      <select name='addrf'>
       <?
       include "dbconnect.inc";
       
       $result = mysql_query("select CODE, SIDO, GUGUN, DONG, RI, ST_BUNJI, ED_BUNJI from zipcode where DONG like'%$dong%' order by CODE");
       $count = mysql_num_rows($result);
       
       if($count == 0) 
       {
        echo"<script>alert('정확한 주소를 입력해주세요.'); history.back();</script>"; 
       }
       
       while($row = mysql_fetch_object($result))
       {
        $CODE = $row ->CODE;
        $SIDO = $row ->SIDO;
        $GUGUN = $row ->GUGUN;
        $DONG = $row ->DONG;
        $RI = $row ->RI;
        $ST_BUNJI = $row ->ST_BUNJI;
        $ED_BUNJI = $row ->ED_BUNJI;
        
        $my_addrf="[".$CODE."]".$SIDO."".$GUGUN."".$DONG."".$RI."";
        $my_addrf2= $CODE."|".$SIDO." ".$GUGUN." ".$DONG." ".$RI."";
        if($ST_BUNJI)
        {
         $my_addrf = $my_addrf.$ST_BUNJI."~".$ED_BUNJI;
        }
        
        echo "<option value='$my_addrf2'>$my_addrf</option>";
       }
       ?>
       </select>
       <input type="submit" value="선택" align="absmiddle">
       </td>
      <tr>
     </table>
    </td>
   </tr>
  </table>
 </td>
</tr>
</table>
</body>
</html>
<?
 }
?>
<?
if($mode == "input")
{
 $postArray = explode("|",$addrf);
 $post1 = substr($postArray['0'],0,3);
 $post2 = substr($postArray['0'],4,3);
 
 $select_addrf = $postArray[1];
 
 
?>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language="javascript">
alert("<?echo $post1?>" + "-" + "<?echo $addrf?>");
 opener.document.NewRecruit.post1.value = "<?echo $post1?>";
 opener.document.NewRecruit.post2.value = "<?echo $post2?>"; 
 opener.document.NewRecruit.addr.value = "<?echo $select_addrf?>";
 opener.document.NewRecruit.addr.focus();
 self.close();
 </script>
<?
}
?>
| 제목 | 
|---|
| 태그 적용 | 
| 여보세요? 손님도 적으실 수 있습니다. 11 | 
| 일 | 월 | 화 | 수 | 목 | 금 | 토 | 
|---|---|---|---|---|---|---|
| 9.28 | 9.29 | 9.30 | 10.1 | 10.2 | 10.3 | 10.4 | 
| 10.5 | 10.6 | 10.7 | 10.8 | 10.9 | 10.10 | 10.11 | 
| 10.12 | 10.13 | 10.14 | 10.15 | 10.16 | 10.17 | 10.18 | 
| 10.19 | 10.20 | 10.21 | 10.22 | 10.23 | 10.24 | 10.25 | 
| 10.26 | 10.27 | 10.28 | 10.29 | 10.30 | 10.31 | 11.1 |