Guest User

Untitled

a guest
Feb 16th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. add-invoice.php
  2. <?php include 'includes/header.php';
  3. include ('includes/connection.php');
  4. extract($_POST);
  5. $id = rand(00,99);
  6. $Invoice_Number = rand(0000,9999);
  7. $date = date("m/Y");
  8. if (isset($_POST['submit'])) {
  9. $Client_Name = $_POST['Client_Name'];
  10. $Item1 = $_POST['Item1'];
  11. $Price1 = $_POST['Price1'];
  12. $Quantity1 = $_POST['Quantity1'];
  13.  
  14. $totalClient_Name = sizeof($Client_Name);
  15.  
  16. for($i=0;$i<$totalClient_Name;$i++) {
  17.  
  18. $Client_Name = $Client_Name[$i];
  19. $Item1 = $Item1[$i];
  20. $Price1 = $Price1[$i];
  21. $Quantity1 = $Quantity1[$i];
  22. $sql = mysqli_query($connection, "INSERT INTO invoice (id, Invoice_Number, Client_Name, Item1, Price1, Quantity1, monthyear)VALUES ('$id', '$Invoice_Number', '$Client_Name', '$Item1', '$Price1', '$Quantity1', '$date')");
  23. }
  24. if (mysqli_num_rows($sql) > 0) {
  25. header("Location: invoice.php");
  26. }
  27. header("Location: invoice.php");
  28. }
  29. ?>
  30. //----------------------//
  31. header.php
  32. <?php
  33. session_start();
  34. include 'includes/connection.php';
  35. extract($_SESSION);
  36.  
  37. if (isset($_SESSION['username'])) {
  38. # code...
  39. }else{
  40. header("Location: index.php");
  41. }
  42.  
  43. ?>
Add Comment
Please, Sign In to add comment