초보질문입니다
A.php 에서
폼값을
<form name="myform" method="post" action="result.php" role="form">
<fieldset>
<legend>취미를 선택해 주세요.</legend>
<!-- 설문항목 -->
<div class="checkbox">
<label>
<input type="checkbox" name="hobby[]" value="음악감상">
음악감상</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="hobby[]" value="영화감상">
영화감상</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="hobby[]" value="게임">
게임</label>
</div>
<button type="submit" class="btn btn-primary">결과보기</button>
</fieldset>
</form>
이런식으로 해서 result.php 로 배열로 넘겼는데요
result.php -------------내용입니다
$hobby = $_POST('hobby');
// 배열 데이터이기 떄문에 문자열로 합쳐야 출력 가능함.
$hobby_str = implode(", ", $hobby);
<?php echo $hobby_str;?>
이렇게 출력했는데도 값이 없습니다. ㅜㅜ
뭐가 잘못됐는지요?
A.php 에서
폼값을
<form name="myform" method="post" action="result.php" role="form">
<fieldset>
<legend>취미를 선택해 주세요.</legend>
<!-- 설문항목 -->
<div class="checkbox">
<label>
<input type="checkbox" name="hobby[]" value="음악감상">
음악감상</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="hobby[]" value="영화감상">
영화감상</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="hobby[]" value="게임">
게임</label>
</div>
<button type="submit" class="btn btn-primary">결과보기</button>
</fieldset>
</form>
이런식으로 해서 result.php 로 배열로 넘겼는데요
result.php -------------내용입니다
$hobby = $_POST('hobby');
// 배열 데이터이기 떄문에 문자열로 합쳐야 출력 가능함.
$hobby_str = implode(", ", $hobby);
<?php echo $hobby_str;?>
이렇게 출력했는데도 값이 없습니다. ㅜㅜ
뭐가 잘못됐는지요?
댓글 2개
게시글 목록
| 번호 | 제목 |
|---|---|
| 33565 | |
| 33549 | |
| 33548 | |
| 33500 | |
| 33497 | |
| 33495 | |
| 33484 | |
| 33483 | |
| 33474 | |
| 33465 | |
| 33464 | |
| 33462 | |
| 33461 | |
| 33457 | |
| 33456 | |
| 33441 | |
| 33440 | |
| 33417 | |
| 33416 | |
| 33415 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기