0

I have a radio button in a html table and form. When the value of the radio button is in text the button returns zero.However when the value is a number the button returns the rue value. The code is below.

<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> 

the radio button post a velue of 11 however when the value of the radio button is changed from 11 to a text e.g. "welcome" the form post value of zero "0" from the radio button

faisal abdulai
  • 3,739
  • 8
  • 44
  • 66

1 Answers1

0

Always put your value="something" between quotes.

Remember to close your HTML Tags, you have this input tag not closed.

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

matiaslauriti
  • 7,065
  • 4
  • 31
  • 43