title: how to Insert calculate values to database
body: <p>I'm trying to insert calculate values to Database.a and b from text field.this is my code.but it doesn't work.please help me</p>
  
  <pre><code>&lt;?php
    require('dbconnection.php');
      $a=$_POST['a'];
      $b=$_POST['b'];
  
      class cal{
     public function insert($a,$b){
  
      if((($a)&amp;&amp;($b))!="")
      {
       $c=$a*$b;
  
      $sql = "INSERT INTO cropplant (sbetweenQ ,sbetweenC ,sbetweenTC ) VALUES ('$a', '$b', '$c')";
      $query = mysql_query($sql);
      if(!$query)
              {
                  echo '&lt;script type="text/javascript"&gt;alert("DB Update error ! please Re-enter your details.");&lt;/script&gt;'; 
              }else
                  {
                  echo '&lt;script type="text/javascript"&gt;alert("New value Added Successfuly.");&lt;/script&gt;'; 
  
              }
  }else{
      echo"please enter all";
      }}}
      ?&gt; 
  </code></pre>