使用单选按钮更新记录

I am trying to update some records using radio buttons I want only the selected record to be updated but it keeps on updating the records from beginning to end . Can anyone tell what is that I am missing

 <?php
  $query = mysql_connect("localhost","root","toor");
   mysql_select_db("busticket",$query);
   $result=mysql_query("Select * from ticket_reservation") or      die(mysql_error());
     while($row=mysql_fetch_array($result))
    {
    echo "<tr><td><input type='radio' name='name[]'   value='".$row['id']."'</td><td> '".$row['id']."'</td><td>".$row['userid']."</td> <td>".$row['busid']."</td><td>".$row['numberofseats']."</td></tr>";
     }
     echo "<tr><td><input type='submit' name='submit[]' value='validate'> </td></tr>";
    ?>
   <?php 
    $name=$_POST['name'];

    $qry="UPDATE ticket_reservation set validate_status='Yes'";
    mysql_query($qry);     

   ?>

There were a couple of issues with the above code, the main one being that there was no where clause specified to your update statement - thus all records get updated when the form is submitted. The radio button was not closed correctly so would have caused issues with the flow of the html. The update clause requires a POSTed variable name yet there was nothing to prevent the server trying to execute the statement in a normal GET request - hence enclosing in the IF statement.

/* Create db connection */
$query = mysql_connect( "localhost", "root", "toor" );
mysql_select_db( "busticket", $query );

/* Update records */
if( $_SERVER['REQUEST_METHOD']=='POST' ){
    $name=$_POST['name'];
    /* Because the field `name` is called `name[]` - array - you need to specify the item in the array, should be the first one ie: index 0 */
    $qry="UPDATE `ticket_reservation` set `validate_status`='Yes' where `id`='".$name[0]."';";
    mysql_query( $qry );
}

/* Display records */
$result=mysql_query("Select * from `ticket_reservation`") or die( 'Error: There was a problem with the query' );

echo "<table>";
while( $row=mysql_fetch_array( $result ) ) {
    echo "
    <tr>
        <td><input type='radio' name='name[]' value='".$row['id']."'></td>
        <td>".$row['id']."</td>
        <td>".$row['userid']."</td>
        <td>".$row['busid']."</td>
        <td>".$row['numberofseats']."</td>
    </tr>";
}
echo "<tr><td><input type='submit' name='submit' value='validate'></td></tr>";
echo "</table>";