2016-06-18 8 views
0

私はラジオボタンをHTMLテーブルとフォームに入れました。ラジオボタンの値がテキストの場合、ボタンはゼロを返します。値が数値の場合、ボタンはrue値を返します。コードは以下の通りです。ラジオボタンのテキストの値はゼロにデフォルト設定されています

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

ラジオボタン、ラジオボタンの値は、例えばテキストに11から変更されたが11のvelueを投稿"歓迎"ラジオボタンから0のフォームポスト値

+0

値は引用符で囲まなければならない –

+0

はいそれらは引用符テスト値は、例えば、引用符内にあるです"welcome" –

+0

gp入力に引用符がないので、 '$ rows ['member_id']'に引用符が含まれていて、入力が閉じていないと非常に驚くでしょう –

答えて

0

必ずvalue="something"を引用符で囲んでください。

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

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

関連する問題