공대여자누님 한번 봐주십시요.

이부분은 제가 자주 혼동됩니다.

자바스크립트와 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>&nbsp;
      <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>
<?
}
?>

 

댓글
  • No Nickname
    No Comment
  • 권한이 없습니다.
    {{m_row.m_nick}}
    -
제목 작성자 날짜
공대여자
mins
야곱
전호현
급한마음에
mins
거치른벌판
거치른벌판
거치른벌판
Mersia
asdas
Test