title: How do I convert $_POST to string then assign to a $variable? Wanna use it in SQL
body: <p>I don't know how to convert this $_POST to string and ASSIGN it to a variale rather than an array. Is there a Convert.ToString(RadioButtonValue) like in C#? I want to use the variable as a parameter in my SQL statement.</p>
  
  <pre><code>$DeptCode = $_POST['Department'];
          print_r($DeptCode);
  
          $sql = "SELECT EMPLOYEE.EmpID, EmpName FROM EMPLOYEE, EMPLOYEE_SPECIALIZATION WHERE EMPLOYEE.EmpID = EMPLOYEE_SPECIALIZATION.EmpID AND EmpStatus='active' AND DeptCode = '$DeptCode'";
          $results = mysql_query($sql,$con);
          if($results != $sql)
          {
              die('Error' . mysql_error());
          }
  </code></pre>
  
  <p>This is my SQL statement. What am I doing wrong?</p>
  
  <pre><code>$sql = "SELECT EMPLOYEE.EmpID, EmpName FROM EMPLOYEE, EMPLOYEE_SPECIALIZATION WHERE EMPLOYEE.EmpID = EMPLOYEE_SPECIALIZATION.EmpID AND EmpStatus='active' AND DeptCode = '$DeptCode'";
  </code></pre>
  
  <p>When I run it... it always show</p>
  
  <pre><code>Array ( [0] =&gt; PD ) Error
  </code></pre>
  
  <p>This is the whole code:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;New Checkup&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;&lt;a href="http://localhost/clinic/InsertPatient.php"&gt;Insert Patient&lt;/a&gt;&lt;/h1&gt;&lt;br&gt;
      &lt;h1&gt;&lt;a href="http://localhost/clinic/InsertEmployee.php"&gt;Insert Doctor and Specialization&lt;/a&gt;&lt;/h1&gt;
      &lt;h1&gt;&lt;a href="http://localhost/clinic/InsertProcedureHTML.php"&gt;Insert Products and Services&lt;/a&gt;&lt;/h1&gt;
      &lt;h1&gt;&lt;a href="http://localhost/clinic/NewCheckup.php"&gt;New Checkup&lt;/a&gt;&lt;/h1&gt;
      &lt;form method="post"&gt;
          &lt;?php
          //action="http://localhost/clinic/NewCheckup2.php"
              $con = mysql_connect('localhost', 'root', "");
              if(!$con)
              {
                  die('Could not connect: ' . mysql_error());
              }   
              mysql_select_db("db_clinic", $con) or die(mysql_error());
              $sql = "SELECT DeptCode, DeptName FROM DEPARTMENT";
              $results = mysql_query($sql,$con);
              while($row=mysql_fetch_assoc($results))
              {                       
                  echo "&lt;input type='radio' name='Department[]' value='".$row['DeptCode']."'&gt;".$row['DeptName'];
              }
              mysql_close($con);
          ?&gt;
          &lt;input type="submit" name="btnSubmit"&gt;
      &lt;/form&gt;
  
      &lt;?php
      if(isset($_POST['btnSubmit']))
      {
          $con = mysql_connect('localhost', 'root', "");
          if(!$con)
          {
              die('Could not connect: ' . mysql_error());
          }
          mysql_select_db("db_clinic", $con) or die(mysql_error());
  
          $DeptCode = $_POST['Department'];
          print_r($DeptCode);
          echo $DeptCode;
          $sql = "SELECT EMPLOYEE.EmpID, EmpName FROM EMPLOYEE, EMPLOYEE_SPECIALIZATION WHERE EMPLOYEE.EmpID = EMPLOYEE_SPECIALIZATION.EmpID AND EmpStatus='active' AND DeptCode = '$DeptCode'";
          $results = mysql_query($sql,$con);
          if($results != $sql)
          {
              die('Error' . mysql_error());
          }
          mysql_close($con);
      }
      ?&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>