2014-11-14 2 views
0

라디오 버튼을 끈적 거리게 만들었지 만,이 코드는 사용자가 이제 하나 이상의 옵션을 선택할 수 있었고 (어떻게 하나만 선택할 수있게되어 있습니다), 어떻게 든 일단 옵션을 선택하면 선택할 수 없게됩니다. 이 내 코드는 바로 지금입니다 :은 라디오 버튼을 고정시킬 수 없습니다.

How did you hear about me?<br/> 
    <input type="radio" name="response_fb" value="true" 
    <?php if (isset($_POST['response_fb']) == 'true') echo ' checked'; ?>>Facebook/online<br> 
<input type="radio" name="response_wordofmouth" value="true" 
<?php if (isset($_POST['response_wordofmouth']) == 'true') echo ' checked'; ?>>Word of mouth<br> 
<input type="radio" name="response_other" value="true" 
<?php if (isset($_POST['response_other']) == 'true') echo ' checked'; ?>>Other 

사람이 도와 드릴까요? 미리 감사드립니다. !

답변

0

모든 라디오 버튼의 이름은 동일해야합니다. 이것이 HTML이 그룹 중 하나만 선택할 수있는 방법입니다.

편집 : 나는 이것이 당신이

<?php if (isset($_POST['response']) == 'true') echo '$_POST['response'] was checked'; ?> 
<input type="radio" name="response" value="facebook"> 
<input type="radio" name="response" value="word_of_mouth"> 
<input type="radio" name="response" value="other"> 
+0

정말 고마워요 !! – mch

0
<input type="radio" name="response" value="facebook" 
    <?php if (isset($_POST['response']) and $_POST['response'] == 'facebook') echo ' checked'; ?>>Facebook/online<br> 
<input type="radio" name="response" value="wordofmouth" 
<?php if (isset($_POST['response']) and $_POST['response'] == 'wordofmouth') echo ' checked'; ?>>Word of mouth<br> 
<input type="radio" name="response" value="other" 
<?php if (isset($_POST['response']) and $_POST['response'] == 'other') echo ' checked'; ?>>Other 

위해 촬영 무엇 U가 동일한 이름과 다른 값을 설정해야합니다보다라고 생각합니다!

+0

정말 고마워요 !! 완벽하게 일했습니다! – mch

관련 문제