title: Update db with value from radio button that has 2 values PHP
body: <p>What i'm trying to do is: I have one radio button and should have 2 values one "Y" and the other "N". User has chosen from drop down list a name and if he wants he can grand or remove administrative role for this persons name (I have other buttons also all of them have the same name as this radio button):</p>
  
  <pre><code>&lt;input type="radio" name="radio" value="&lt;?php 
                  if ($r['admin']=='N' &amp;&amp; $r['username']==$un){ print "Y\"&gt; Grant Administrator Role&lt;br&gt;";}
                  if ($r['admin']=='Y' &amp;&amp; $r['username']==$un){ print "N\"&gt; Revoke Administrator Role&lt;br&gt;";}
              ?&gt;
  </code></pre>
  
  <p>$un is </p>
  
  <pre><code>$_SESSION['username']=$_POST['username'];
  $un=$_SESSION['username']
  </code></pre>
  
  <p>So if this chosen name has in db for admin attribute value of "N" the radio button needs to say Grant Administrator Role and if in db the value is "Y" the radio button needs to say Revoke Administrator Role.</p>
  
  <p>I'm having a hard time to update the value in db when this radio button is selected. Here is my code so far:</p>
  
  <pre><code>if($_SESSION['status']=='Y'){
                              $qadmin="UPDATE users SET admin='{$_SESSION['status']}' WHERE username='{$_SESSION['username']}'";
                              $qa=mysqli_query($dbc,$qadmin);
                              print "selected radio is ".$_SESSION['status']."username ".$_SESSION['username'];
                              //header("Location: status.php");
                          }
  </code></pre>
  
  <p>if($_SESSION['status']=='N'){
                                  $qadmin="UPDATE users SET admin='{$_SESSION['status']}' WHERE username='{$_SESSION['username']}'";
                                  $qa=mysqli_query($dbc,$qadmin);
                                  print "selected radio is ".$_SESSION['status']."username ".$_SESSION['username'];
                                  //header("Location: status.php");
                              }</p>
  
  <p>The result that I'm getting here is:
  When the chosen username is with value in db "N" the update is done correctly, but when the username has value of "Y" and the radio button says now Revoke Administrator Role the value of the $_SESSION['status'] is again "Y".</p>
  
  <p>I know I must miss something very simple but I cant figure it out. Please advise and sorry form my very very long question. Thank you in advance   </p>