如何使用php在mysql两列中划分和插入后值整数数据?

时间:2019-05-19 09:41:16

标签: mysql php


   <form>
    Service fee :
   <input type="text" value="300" name="gst">
   <select>
   <option>CGST 9% AND SGST 9% on service fee</option>
   <option>IGST 18% on service fee</option>
   </select> 
   <input type="text" value="54" name="tax">  // value get calculate on service fee is 54 (after javascipt programme)
   <input type="submit"  name="submit">

   </form>

   <?php

    $ctax= $_POST['tax'];  
    $ctax2= $ctax/2;  
    $ctax3= $ctax/2;
    sql_query= "INSERT INTO VISAINVC(cgst9%,sgst9%) VALUES('$ctax2','$ctax3')"

   ?>

帖子值应该被划分并插入到mysql visainvc表中,即

  • table column -> CGST 9% = 27 (50% of 54 - 18% ON SERVICE FEE i.e 300 )
  • table column -> SGST 9% = 27 (50% of 54 - 18% ON SERVICE FEE i.e 300 )

1 个答案:

答案 0 :(得分:0)

首先将列名cgst9%,sgst9%更改为cgst和sgst,然后在注释部分添加其他信息。另一件事是根据它的列data_type(int OR varchar)插入值。

git init