HTML 배열 submit

HTML 배열 submit

1 submit_array.html[ | ]

<form method='post' action='submit_array_ok.php'>
	<input type='hidden' name='fruits[]' value='귤' />
	<input type='hidden' name='fruits[]' value='사과' />
	<input type='hidden' name='fruits[]' value='배' />
	<input type='hidden' name='fruits[]' value='파인애플' />
	<button>보내기</button>
</form>

2 submit_array_ok.php[ | ]

<?php
if( !isset( $_POST['fruits'] ) ) {
	echo 'fruits 없음';
	exit;
}
print_r( $_POST['fruits'] );
// Array ( [0] => 귤 [1] => 사과 [2] => 배 [3] => 파인애플 )

3 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}