두 번째 양식에 숨겨진 필드를 추가하고 PHP에서 설정되었는지 확인합니다.이 경우 두 번째 양식이 사용되었습니다.
-------------------두 양식에서 이름이 같은 숨겨진 필드 가져 오기 (필요한 경우 다른 ID)
그런 다음 숨겨진 필드 만 확인하면됩니다.
-------------------숨겨진 필드를 가져갈 필요가 없습니다.
PHP :
if(isset['send2'])) { echo "Form2 submitted !" ;?> }
-------------------<script>
$(document).ready(function() {
$('#img_send_form').click(function() {
$('#form2').submit();
});
});
</script>
<form name="form1" action="#" method="post">
<input type="text" name="field1"/>
<input type="submit" name="send1"/>
</form>
<form name="form2" action="#" method="post">
<input type="hidden" name="form2_send"/>
<input type="text" name="field1"/>
<input type="text" name="field2"/>
<input type="text" name="field3"/>
<input type="text" name="field4"/>
<input type="text" name="field5"/>
<input type="text" name="field6"/>
<input type="text" name="field7"/>
<input type="submit" name="send2"/>
</form>
<img src="xxx" id="img_send_form"/>
그리고 PHP :
if(isset['form2_send'])) { echo "Form2 submitted !" ;?> }
출처
https://stackoverflow.com/questions/22008797