2014-01-17 23 views
0

我有問題單選按鈕,如果在for循環

<input type="radio" value="1" name="is_active_<?php echo $v['class_id'] ?>" id="is_active_<?php echo $v['class_id'] ?>" <?php if($v['display_online']==1){ echo ' checked'; }?> > 
<label for="is_active_no_<?php echo $v['display_online'] ?>">Yes </label> 
<input type="radio" value="0" <?php if($v['display_online']==0){ echo 'checked'; }?> name="is_active_<?php echo $v['class_id'] ?>" id="is_active_<?php echo $v['class_id'] ?>"> 
<label for="active_yes_<?php echo $v['display_online'] ?>"> No </label> 

在for循環。 看到圖像: - enter image description here 看到HTML輸出: -

<input type="radio" id="is_active_47568" name="is_active_47568" checked="checked" value="1"> 
<label for="is_active_no_1">Yes </label> 
<input type="radio" id="is_active_47568" name="is_active_47568" value="0"> 
<label for="active_yes_1"> No </label> 

,但檢查不工作是什麼問題?

在此先感謝。

+1

嘗試'回聲檢查=「檢查」;' –

+0

你好@AlirezaFallah我都試過,但它也沒有工作。 – User1988

+0

粘貼此代碼生成的HTML輸出 –

回答

0

如果單選按鈕的名稱相同,即分組然後「檢查」將只能用於一個單選按鈕...

+0

hello @ user1844933每一行都有不同的組。 – User1988

+0

顯示你的html輸出沒有選中按鈕 – user1844933

+0

hello @ user1844933 html輸出有什麼問題請告訴我。 – User1988