단순한 실수 일 뿐이라고 생각하지만 지금까지는 마지막 else if {} 문이 실행되지 않는 이유에 대한 해결책을 얻을 수 없습니다 조건을 충족시킵니다.CodeIgniter - 마지막 else 문이 조건을 충족시키지 못함
내 양식입니다. 사용자가 값을 입력 할 수있는 옵션으로 3 가지 양식 요소가 있습니다. 텍스트, 사진 또는 영화를 업로드하도록 선택할 수 있습니다. 여기 내 PHP입니다 :
if ($this->input->post('text') !== '') {
//this executes fine when it meets the condition
} else if ($this->input->post('photo') !== '') {
// this also works fine
} else if ($this->input->post('video') !== '') {
/* however, I can't get to this condition when
the user chooses to upload the movie.
It always go the second condition.
*/
}
편집 : 어떤 생각이 정말 감사하겠습니다
<form action="<?php echo base_url()?>action/post" method="post" enctype="multipart/form-data">
<ul class="nav nav-tabs">
<li class="active">
<a href="#status" data-toggle="tab">Update Status</a>
</li>
<li>
<a href="#photos" data-toggle="tab">Post Photos</a>
</li>
<li>
<a href="#videos" data-toggle="tab">Post Videos</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="status">
<textarea name="text"></textarea>
</div>
<div class="tab-pane" id="photos">
<input type="file" name="photo" class="input" />
<input type="text" name="photos-detail" placeholder="description" />
</div>
<div class="tab-pane" id="videos">
<input type="file" name="video" class="input" />
<input type="text" name="videos-detail" placeholder="description" />
</div>
</div>
<button type="submit" class="btn btn-primary" name="post">Post</button>
</form>
:
이여기 내보기입니다.
은 무엇을 위해서 var_dump ($ _ POST)는 (은 if 문 전에) 당신에게 무엇입니까? – Rooneyl
보기에 코드를 붙여 넣을 수 있습니까? – m4t1t0
파일 양식 요소가 게시되었는지 테스트하려면이 [대답] [1]을 참조하십시오. [1] : http://stackoverflow.com/questions/2958167/how-to-test-if-a-user-has-selected-a-file-to-upload – Rooneyl