하나의 입력 필드가 있지만 두 개의 버튼이있는 양식이 있습니다. 아이디어는 코드로 체크인 또는 체크 아웃하는 것입니다. 프로세스는 php 파일에 오는데, 여기서 빈 페이지로 끝납니다. 뭐가 문제 야?두 개의 버튼이있는 입력 필드
내가 "btn_in"을 "inputAnst_nr을"로 변경 그리고 이제에 등록 할 수 있습니다.하지만, 내가 어떻게 느릅 나무 버튼을 누를 때 가져 오기 위해 노력하고 EDIT?
HTML
<form class="form-inline well" id="usr_stamp" name="usr_stamp" method="post" action="php/usr_time_reg.php">
<div class="control-group">
<input id="inputAnst_nr" name="inputAnst_nr" class="form-control input-lg" placeholder="Ange Anst. nr" type="tel">
<button id="btn_in" name="btn_in" class="btn btn-lg btn-info primary col-sm-offset-1" type="submit">In</button>
<button id="btn_out" name="btn_out" class="btn btn-lg btn-danger primary col-sm-offset-1" type="submit">Ut</button>
</div>
</form>
JS
$(document).ready(function() {
$("#btn_in").on('click', function() {
$("#usr_stamp").attr("action", "php/usr_time_reg.php");
});
$("#btn_out").on('click', function() {
$("#usr_stamp").attr("action", "php/usr_time_reg.php");
});
});
PHP
//Check if POST is empty
if(!empty($_POST)){
//Check if POST is "inputAnst_nr"
if(!empty($_POST['inputAnst_nr'])){
//Put POST_btn_in in variable
$posted_anst_nr = $_POST['inputAnst_nr'];
왜 JS? - 덧글 달기가 너무 빠름으로 편집하십시오 – Epodax