title: PHP script works on my local pc but not on my server
body: <p>I have a simple PHP script, to take the data enter on a form and store it in mysql database. When I run it on my PC it enters the data correctly, but, when I run it from my online server it display my PHP script on a new page!</p>
  
  <p>Here is my code:</p>
  
  <hr>
  
  <pre><code> &lt;?php
      $servername = "localhost";
      $username = "theuser";
      $password = "thepassword";
      $dbname = "thedb";
  
      $cName['c_name'] = isset($_POST['c_name']);
  
      try {
      $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
  
      // set the PDO error mode to exception
  
      $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  
      $sql = "INSERT INTO the_tb (c_name,c_reg,c_tel1,c_tel2,f_name,l_name,m_tel,email_addr1,email_addr2,p_addr1,p_addr2,p_city,p_county,p_code,p_country,contact_message,yes_no) VALUES ('$_POST[c_name]','$_POST[c_reg]','$_POST[c_tel1]','$_POST[c_tel2]','$_POST[f_name]','$_POST[l_name]','$_POST[m_tel]','$_POST[email_addr1]','$_POST[email_addr2]','$_POST[p_addr1]','$_POST[p_addr2]','$_POST[p_city]','$_POST[p_county]','$_POST[p_code]','$_POST[p_country]','$_POST[contact_message]','$_POST[yes_no]')";
  
      // use exec() because no results are returned
      $conn-&gt;exec($sql);
  
      echo "'$_POST[c_name]','$_POST[c_reg]','$_POST[c_tel1]','$_POST[c_tel2]','$_POST[f_name]','$_POST[l_name]','$_POST[email_addr1]','$_POST[email_addr2]','$_POST[p_addr1]','$_POST[p_addr2]','$_POST[p_city]','$_POST[p_county]','$_POST[p_code]','$_POST[p_country]','$_POST[contact_message]','$_POST[yes_no]'.";
  
          }
      catch(PDOException $e)
          {
          echo $sql . "&lt;br&gt;" . $e-&gt;getMessage();
          }
  
      $conn = null;
  ?&gt;
  </code></pre>
  
  <hr>
  
  <p>As I said it works on my local workstation. Now I have checked that I have the same version on PHP installed as well as all the relevant modules and all seem to be the same.</p>
  
  <p>I know that I have made a mistake somewhere but for the life of me I cannot see where. Could one you guys PHP expert can tell me where I went wrong?</p>
  
  <p>Thank you kindly</p>