title: how to insert the textbox values to the database mysql using php oops concept when clicked on the Submit button
body: <pre><code>&lt;html&gt;
  &lt;body&gt;
  
  &lt;form action="database.php" method="post"&gt;
  Name : &lt;input type ="text" name = "Name"/&gt;
  
  Number  :&lt;input type ="text" name = "Number"/&gt;
  &lt;input type ="submit" value = "submit" name="submit"/&gt;
  
  &lt;/form&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  &lt;?php
  
  class Database
  {
  
      var $host;
      var $user;
  
      var $pass;
      var $data;
  
      var $con;
      var $table;
  
      var $db;
       public function controls()
  
      {
         $this-&gt;host="localhost";
  
          $this-&gt;user="root";
          $this-&gt;pass="";
  
          $this-&gt;data="employeedatabase";
         }
  
      public function connection()
      {
  
          $this-&gt;con = mysql_connect($this-&gt;host,$this-&gt;user,$this-&gt;pass);
      }
  
      public function tablename()
      {
  
          $this-&gt;table=mysql_query("INSERT INTO employee(name,number) VALUES ('".$_POST[name]."','".$_POST[number]."')");
  
      }
  public function databaseconnection()
  
      {
          $this-&gt;db=mysql_select_db($this-&gt;data,$this-&gt;con);
  
      }
  }
  
  $name=new Database();
  $name-&gt;controls();
  
  $name-&gt;connection();
  if(!($name-&gt;con))
  
  {
      echo 'Error: ' . mysql_error();
  
  }
  $name-&gt;databaseconnection();
  
  $name-&gt;tablename();
  ?&gt;
  </code></pre>