Advertisement
Guest User

Untitled

a guest
Jun 1st, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $conusername = "root";
  4. $conpassword = "";
  5. $dbname = "annapoorna";
  6. $dsn='mysql:dbname='.$dbname.';host='.$servername;
  7. $conn = new PDO($dsn, $conusername, $conpassword);
  8. $date="";
  9. $category_value="";
  10. $item_value="";
  11. $vendor_value="";
  12. $unit_value="";
  13. $price_rate_value="";
  14. $quantity_value="";
  15. $vat_value="";
  16. $freight_value="";
  17. $other_charges_value="";
  18. $total_value="";
  19. if( !empty($_POST['category']) && !empty($_POST['item_name']) &&!empty($_POST['vendor_name']) && !empty($_POST['Unit']) && !empty($_POST['Price_per_Unit']) && !empty($_POST['Quantity']) && !empty($_POST['VAT']) && !empty($_POST['Freight_charges'])&& !empty($_POST['Other_Charges']))
  20. {
  21. //$date=$_POST['datepicker'];
  22. $category_value=$_POST['category'];
  23. $item_value=$_POST['item_name'];
  24. $vendor_value=$_POST['vendor_name'];
  25. $unit_value=$_POST['Unit'];
  26. $price_rate_value=$_POST['Price_per_Unit'];
  27. $quantity_value=$_POST['Quantity'];
  28. $vat_value=$_POST['VAT'];
  29. $freight_value=$_POST['Freight_charges'];
  30. $other_charges_value=$_POST['Other_Charges'];
  31. $total_value=$price_rate_value * $quantity_value;
  32. $sth = $conn->prepare('INSERT INTO bill (date, category, item, vendor, unit, price_per_unit, quantity, vat, freight_charges, other_charges, total) VALUES (CURRENT_DATE, :category, :item, :vendor, :unit, :rate, :quantity, :vat, :freight, :other, :total)');
  33. $sth->execute(array(':category'=>$category_value,':item'=>$item_value,':vendor'=>$vendor_value,':unit'=>$unit_value,':rate'=>$price_rate_value,':quantity'=>$quantity_value,':vat'=>$vat_value,':freight'=>$freight_value,':other'=>$other_charges_value,':total'=>$total_value));
  34. header( "Refresh: 0;" );}
  35. ?>
  36.  
  37. <form method="POST">
  38. <input type="submit" name="submit" value="Update" style="width:150px;padding:10px;">
  39. //php written above
  40. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement