簡體   English   中英

單選按鈕的文本值默認為零

[英]Text Value of Radio Button Defaults to Zero

我在html表格和表單中有一個單選按鈕。 當單選按鈕的值是文本時,該按鈕返回零;但是當該值是數字時,該按鈕返回rue值。 代碼如下。

 <form method="POST" action='insert_per.php'> <table > <thead> <tr> <th class="center"><strong>Name</strong></th> <th class="center"><strong>Email</strong></th> <?PHP if($_SESSION['user_group'] == 63){ echo '<th class="center"><strong>System Admin</strong></th>'; echo '<th class="center"><strong>Admin</strong></th>'; echo '<th class="center"><strong>User</strong></th>'; } </tr> </thead> <?php if($stmt->execute()){ // output data of each row while($rows = $stmt->fetch(PDO::FETCH_ASSOC)){ ?> <tr> <td border="0" type="hidden" style="display:none;"><input type="hidden" name="hidden" value=<?php echo $rows['member_id']; ?></td> <td class="center"><?php echo $rows['username']; ?></td> <td class="center"><?php echo $rows['email']; ?></td> <td class="center"><input type="radio" name="gp" value=11></input></td> <td class="center"><button name="submit" type="submit">submit</button></td> </tr> <?php } } ?> </table> </form> 

單選按鈕發布的消息為11,但是當單選按鈕的值從11更改為文本(例如“歡迎”)時,單選按鈕的表單發布值為零“ 0”

始終將您的value="something"放在引號之間。

請記住,要關閉HTML標記,請關閉此input標記。

<input type="hidden" name="hidden" value="<?php echo $rows['member_id']; ?>" >

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM