0

HTMLテーブルとフォームにラジオボタンがあります。ラジオ ボタンの値がテキストの場合、ボタンはゼロを返します。ただし、値が数値の場合、ボタンは正しい値を返します。コードは以下です。

<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」のフォームポスト値が送信されます

4

1 に答える 1

0

常にvalue="something"引用符の間に入れてください。

HTML タグを閉じることを忘れないでください。このinputタグは閉じられていません。

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

于 2016-06-19T00:17:07.493 に答える