개발 Q&A

제목 폼문 질문
글쓴이 이지포토 작성시각 2013/05/10 16:09:23
댓글 : 5 추천 : 0 스크랩 : 0 조회수 : 18354   RSS
 폼문 전달이 안되네요.
이상하네요. 

 
 
원문: 폼 양식
 
 
 
서브밋후
 
이때 print_r($_REQUEST) 해 보면 매개변수 전달이 안됩니다. 이상하네요.
 
즉 $_POST 값이나 $_GET 값 자체가 안들어 옵니다.
 
 
 
 
//컨트롤 파일 ( /application/service/receipt.php 파일 )
 
class Receipt extends CI_Controller {
 
function __construct()
{
parent::__construct();
 
$this->load->library('form_validation');
$this->load->model('receipt_model', 'receipt'); 
 
}
 
    function dinsert()  
    {
        @extract($_POST);
 
$data['post_link'] = '/service/receipt/dinsert';
$data['main_content'] = 'receipt/insert_view';
 
$this->form_validation->set_rules('s_code', '  ** 접수변호', 'required');
 
if ($this->form_validation->run() == false)
{
$data['newCode'] = $this->receipt->createServiceCode(date('Y')); 
$data['select_dcas_equip'] = $this->receipt->select_dcas_equip(); 
$data['select_dcas_hospital'] = $this->receipt->select_dcas_hospital(); 
$data['select_gp_mem'] = $this->receipt->select_gp_mem(); 
$data['mode'] = "input";
$this->load->view('service/includes/template', $data);
}
else
{
_print_r($_REQUEST); exit;
if($this->receipt->kcInsert()){  
$msg = "성공적으로 등록 되었습니다."; Alert($msg); redirect('/service/receipt');
}else{
$msg = "등록에 실패하였습니다."; Alert($msg); echo $this->db->last_query(); exit;
}
}
}
 
 
 
 
//뷰파일 ( /application/view/service/receipt/insert_view.php 파일 )
 
 
<form id="aform" name="aform" method="get"  accept-charset="utf-8">
<input type="text" id="s_code" name="s_code" value="<?=$newCode?>"/>
.....
</form>
 
 
<A HREF="#" onClick="jsInsert();">등 록 </A>
 
 
<SCRIPT LANGUAGE="JavaScript">
<!--
function jsInsert() {
document.aform.target = "/service/receipt/dinsert";
document.aform.submit();
      
}
//-->
</SCRIPT>
 
 
 
.htaccess 파일 
RewriteEngine On
RewriteBase /
 
RewriteCond $1 !^(index\.php|images|css|js|include|robots\.txt|favicon\.ico)
 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L] 
 
ErrorDocument 404 /index.php
 
<h2>서비스 접수</h2>
<form id="aform" name="aform" method="get"  accept-charset="utf-8">
<table cellpadding="2" cellspacing="1" border="0" id="serviceViewTable">
 <tr>
  <th colspan="2">접수변호</th>
  <td><input type="text" id="s_code" name="s_code" value="<?=$newCode?>"/></td>
 </tr>
 <tr>
  <th colspan="2">접수일시</th>
  <td><input type="text" id="s_time" name="s_time" value="<?=date('Y-d-m H:i:s')?>" style="width:200px"/></td>
 </tr>
 <tr>
  <th colspan="2">장비</th>
  <td>
   
   <select name="equip_divi" id="equip_divi">
    <option value="">장비선택</option>
    <!-- Begin EQUIP -->
  <?  foreach($select_dcas_equip as $row) { ?>
    <option value="<?=$row['equip_code']?>"><?=$row['equip_name']?></option>
  <? } ?>
    <!-- End EQUIP -->
   </select>

  </td>
 </tr>
 <tr>
  <th width="80" rowspan="3">요청<br>병원</th>
  <th width="80">병원명</th>
  <td > 
   <select name="hospital" id="hospital"> 
    <option value="">병원선택</option>
    <!-- Begin HLIST -->
  <?  foreach($select_dcas_hospital as $row) { ?>
    <option value="<?=$row['hcode']?>"><?=$row['hname']?></option>
  <? } ?>
    <!-- End HLIST -->
   </select>
  </td>
 </tr>
 <tr>
  <th width="80">요청부서</th>
  <td > <input type="text" name="h_part" id="request_d" value=""/></td>
 </tr>
 <tr>
  <th width="80">요청자</th>
  <td > <input type="text" name="h_user" id="request_u" value=""/></td>
 </tr>
 <tr>
  <th width="80" rowspan="2">접수</th>
  <th width="80">접수자</th>
  <td > 
   <select name="recive_mem" id="recive_mem">
    <option value="">접수자</option>
    <!-- Begin recive_mem -->
  <?  foreach($select_gp_mem as $row) { ?>
    <option value="<?=$row['mem_id']?>"><?=$row['mem_name']?></option>
  <? } ?>
    <!-- End recive_mem -->
   </select>

  </td>
 </tr>
 <tr>
  <th width="80">담당자</th>
  <td > 
   
   <select name="incharge_mem" id="incharge_mem">
    <option value="">담당자</option>
    <!-- Begin INCHARGE_USER -->
  <?  foreach($select_gp_mem as $row) { ?>
    <option value="<?=$row['mem_id']?>"><?=$row['mem_name']?></option>
  <? } ?>
    <!-- End INCHARGE_USER -->
   </select>
  </td>
 </tr>
 <tr>
  <th width="80" rowspan="3">처리</th>
  <th width="80">처리유형</th>
  <td > 
   <select name="proc_type" id="proc_type">
    <option value="">처리유형</option>
    <option value="T" >전화처리</option>
    <option value="S" >방문처리</option>
   </select>
  </td>
 </tr>
 <tr>
  <th width="80">상태</th>
  <td > 
   <input type="radio" id="state1" name="service_state" value="R" style="display:inline"  /><label for="state1" style="display:inline">접수</label>
   <input type="radio" id="state2" name="service_state" value="P" style="display:inline"  /><label for="state2" style="display:inline">처리중</label>
   <input type="radio" id="state3" name="service_state" value="E" style="display:inline"  /><label for="state3" style="display:inline">처리완료</label></td>
 </tr>
 <tr>
  <th width="80">결과문서</th>
  <td > <input type="text" name="as_code" id="as_code" value=""/></td>
 </tr>
 <tr>
  <th colspan="2">비고</th>
  <td > <textarea type="text" name="remark" id="remark" rows="5" style="width:90%"> </textarea></td>
 </tr> 
</table>
<A HREF="#" onClick="jsInsert();">등 록 
</A><button type="button" onClick="serviceView()">취 소</button>
</form>


<SCRIPT LANGUAGE="JavaScript">
<!--
 function jsInsert()
 {
  var afrm = document.aform;
   

   document.aform.target = "/service/receipt/dinsert";
   document.aform.submit();
         
 } 
//-->
</SCRIPT>

 
 다음글 서버 이전 하고 있는데요.. 헬퍼가 안먹네요 .. (3)
 이전글 restful 을 이용한 api 서버 구축중인데, 조언... (3)

댓글

변종원(웅파) / 2013/05/10 16:36:51 / 추천 0
get 크기 제한 있습니다.

그리고 get만 안들어온다면 config.php의 uri 관련 옵션 바꾸면 되는데 post까지 안들어오는건
문제가 있네요. (get으로 보내니 post는 당연히 없겠죠? 뷰에서 method를 post로 바꾸고 해보신거죠?)

$this->input->post() 도 안나오는지 찍어보세요.
변종원(웅파) / 2013/05/10 16:45:26 / 추천 0


document.aform.target = "/service/receipt/dinsert";


이게 틀렸네요. 타겟이 아니라 액션입니다.

이동합니다.
이지포토 / 2013/05/10 16:59:09 / 추천 0

POST 로 되 어 있었는데 안되서 GET 으로 테스트 해 본겁니다.
그나 저나 저 action 을 자스에 안넣고 폼에 넣어서 해 보았었는데 그땐 안되다가 지금은  document.aform.acrion 으로 하니깐 전달 되네요 .

제 눈이 분명 삔게 분명합니다. 뭔가 안보이기 시작했나봐요.
이제 쉴때가 되었나요? ^^

웅파님께 감사 드립니다.
 

risa / 2013/05/10 18:36:28 / 추천 0
원래 자기 코드의 실수는 잘 안보이는 법이죠

특히나 간단한 미스를 더더욱 ( ..)

전 
<input type='text' id='abc'> 

이렇게 해놓고

$this->input->post('abc',true);

왜 값이 안오나 한참을 생각 했었답니다 ( ..)
변종원(웅파) / 2013/05/10 19:05:17 / 추천 0
^^ 

항상 삽질의 위험을 안고 사는거죠.

전 

<script></script> 안써놓고 자바스크립트가 왜 실행 안되나 했던 적도 있습니다. (c+c, c+v 폐단. ㅎㅎ)

웃긴건 파목이던 어느 브라우저건 에러가 안났다는 겁니다