HTML 라디오 버튼

Jmnote (토론 | 기여)님의 2012년 6월 21일 (목) 11:11 판
HTML RADIO button
HTML 라디오 버튼
HTML RADIO 버튼

1 radio_button.php

<!DOCTYPE html>
<meta charset="utf-8" />
<title>라디오 버튼</title>
<form method='post' action='radio_button_ok.php'>
<input TYPE='radio' id='r1' name='fruit' value='apple' />
<label for='r1'>사과</label>
<input TYPE='radio' id='r2' name='fruit' value='banana' />
<label for='r2'>바나나</label>
<input TYPE='radio' id='r3' name='fruit' value='lemon' checked='checked' />
<label for='r3'>레몬</label>
<input type='submit' value='제출' />
</form>

2 radio_button_ok.php

<?php
echo '<xmp>';
print_r($_POST);
echo '</xmp>';
?>

3 예제

  • 바나나를 선택하고 [제출] 누른 경우
Array
(
    [fruit] => banana
)

4 같이 보기

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