토타토타

input 을 echo 에서 하려고 하는데요

<input type="radio"  name="bo_1" value="test" <?=$board[bo_1]=="test"?"checked":""?>>

위의 내용을

echo "<input type='radio'  name='bo_1' value='test' <?=$board[bo_1]=="test"?"checked":""?>>";

위와 같이 해야 하는데요

<?=$board[bo_1]=="test"?"checked":""?> <-- 이부분을 어떻게 바꿔줘야 서식에 맞게 되는걸까요?

별걸 다 해봐도 안되네요 ㅜㅜ 이래서 기초가 튼튼해야되나봐요 ㅎ
|

댓글 4개

if($board[bo_1] == 'test') {
echo "<input type=radio name=bo_1 value='test' checked>";
} else {
echo "<input type=radio name=bo_1 value='test'>";
}

쉽게쉽게 풀어서^^
답변 감사합니다 그런데 하나가 아니구요 ㅜㅜ 세개에요

echo "<input type="radio" name="bo_1" value="test" <?=$board[bo_1]=="test"?"checked":""?>>
<input type="radio" name="bo_1" value="test1" <?=$board[bo_1]=="test1"?"checked":""?>>
<input type="radio" name="bo_1" value="test2" <?=$board[bo_1]=="test2"?"checked":""?>>";
아니면 이렇게 해 보는 건 어떠실지...

echo 문을 안 쓰고

?>

<input type="radio" name="bo_1" value="test" <?=$board[bo_1]=="test"?"checked":""?>>
<input type="radio" name="bo_1" value="test1" <?=$board[bo_1]=="test1"?"checked":""?>>
<input type="radio" name="bo_1" value="test2" <?=$board[bo_1]=="test2"?"checked":""?>>

<?
?>

저는 쉽게 기냥 이렇게 합니다만 ㅡㅡ;;
if ($row[bo_1] == 'test1')
$checked1="checked";
else if ($row[bo_1] == 'test2')
$checked2="checked";
else if ($row[bo_1] == 'test3')
$checked3="checked";

그냥 이렇게 했습니다.
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
16년 전 조회 781
16년 전 조회 852
16년 전 조회 969
16년 전 조회 856
16년 전 조회 835
16년 전 조회 1,649
16년 전 조회 1,605
16년 전 조회 985
16년 전 조회 853
16년 전 조회 1,003
16년 전 조회 1,377
16년 전 조회 1,048
16년 전 조회 1,010
16년 전 조회 1,559
16년 전 조회 1,056
16년 전 조회 1,561
16년 전 조회 957
16년 전 조회 1,066
16년 전 조회 1,467
16년 전 조회 1,563