Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add-invoice.php
- <?php include 'includes/header.php';
- include ('includes/connection.php');
- extract($_POST);
- $id = rand(00,99);
- $Invoice_Number = rand(0000,9999);
- $date = date("m/Y");
- if (isset($_POST['submit'])) {
- $Client_Name = $_POST['Client_Name'];
- $Item1 = $_POST['Item1'];
- $Price1 = $_POST['Price1'];
- $Quantity1 = $_POST['Quantity1'];
- $totalClient_Name = sizeof($Client_Name);
- for($i=0;$i<$totalClient_Name;$i++) {
- $Client_Name = $Client_Name[$i];
- $Item1 = $Item1[$i];
- $Price1 = $Price1[$i];
- $Quantity1 = $Quantity1[$i];
- $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')");
- }
- if (mysqli_num_rows($sql) > 0) {
- header("Location: invoice.php");
- }
- header("Location: invoice.php");
- }
- ?>
- //----------------------//
- header.php
- <?php
- session_start();
- include 'includes/connection.php';
- extract($_SESSION);
- if (isset($_SESSION['username'])) {
- # code...
- }else{
- header("Location: index.php");
- }
- ?>
Add Comment
Please, Sign In to add comment