<? ob_start(); ?>
<?php
/*
Author: Javed Ur Rehman
Website: https://www.allphptricks.com/
*/
 
require('db.php');
include("auth.php");

$status = "";
if(isset($_POST['new']) && $_POST['new']==1)
{
$trn_date = date("Y-m-d H:i:s");
$tracknumber =$_REQUEST['tracknumber'];
$receivername = $_REQUEST['receivername'];
$receivernos = $_REQUEST['receivernos'];
$receiveradd = $_REQUEST['receiveradd'];
$sendername = $_REQUEST['sendername'];
$sendernos = $_REQUEST['sendernos'];
$senderadd = $_REQUEST['senderadd'];
$itemdescript = $_REQUEST['itemdescript'];
$weight = $_REQUEST['weight'];
$datesent = $_REQUEST['datesent'];
$deliverydate = $_REQUEST['deliverydate'];
$mode = $_REQUEST['mode'];
$invoice = $_REQUEST['invoice'];
$origin = $_REQUEST['origin'];
$destination = $_REQUEST['destination'];
$report = $_REQUEST['report'];
$content = $_REQUEST['content'];
$location1 = $_REQUEST['location1'];
$goodsstatus = $_REQUEST['goodsstatus'];
$submittedby = $_SESSION["username"];
$ins_query="insert into new_record (`trn_date`,`tracknumber`,`receivername` , `receivernos` , `receiveradd` , `sendername` , `senderadd` , `sendernos` , `itemdescript` , `weight` , `datesent` , `deliverydate` , `mode` , `invoice` ,  `origin` , `destination` , `report` , `content` , `location1` , `goodsstatus` ,  `submittedby`) values ('$trn_date','$tracknumber','$receivername','$receivernos','$receiveradd','$sendername','$senderadd','$sendernos','$itemdescript','$weight','$datesent','$deliverydate','$mode','$invoice','$origin','$destination','$report','$content','$location1','$goodsstatus','$submittedby')";
mysqli_query($con,$ins_query) or die(mysql_error());
$status = "New Tracking Created Successfully.</br></br><a href='view.php'>View Tracking Created</a>";
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert New Record</title>
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<div class="form">
<p><a href="dashboard.php">Home</a> | <a href="view.php">View All Tracking</a> | <a href="logout.php">Logout</a></p>

<div>
<h1>Create New Tracking</h1>
<p style="color:#FF0000;"><?php echo $status; ?></p>
<form name="form" method="post" action=""> 
<input type="hidden" name="new" value="1" />
<label>Tracking Number: </label><input type="text" name="tracknumber" placeholder="Enter Tracking Number" />
<label>Receiver Name: </label><input type="text" name="receivername" placeholder="Enter Receiver Name" />
<label>Receiver Number:</label><input type="text" name="receivernos" placeholder="Enter Receiver Number"  />
<label>Receiver Address: </label><input type="text" name="receiveradd" placeholder="Enter Receiver Address"  />
<label>Sender Name: </label><input type="text" name="sendername" placeholder="Enter Sender Name" />
<label>Sender Number: </label><input type="text" name="sendernos" placeholder="Enter Sender Number" />
<label>Sender Address: </label><input type="text" name="senderadd" placeholder="Enter Sender Address" />
<label>Parcel Content: </label><input type="text" name="itemdescript" placeholder="Enter Parcel Content" />
<label>Parcel Weight: </label><input type="text" name="weight" placeholder="Enter Parcel Weight" />
<label>Departure Date: </label><input type="text" name="datesent" placeholder="Enter Departure Date"  />
<label>Arrival Date: </label><input type="text" name="deliverydate" placeholder="Enter Arrival Date" />
<label>Transport Mode: </label><input type="text" name="mode" placeholder="Enter Transport Mode"  />
<label>Shipping Fee: </label><input type="text" name="invoice" placeholder="Enter Shipping Fee" />
<label>Origin Country: </label><input type="text" name="origin" placeholder="Enter Origin Country" />
<label>Destination Country: </label><input type="text" name="destination" placeholder="Enter Destination Country" />
<label>First Report</label><input type="text" name="report" placeholder="Enter First Report" />
<label>Content:  </label><input type="text" name="content" placeholder="Enter Content of the Parcel/Box" />
<label>Current Location: </label><input type="text" name="location1" placeholder="Enter Current Location" />
<label>Status of Parcel: </label><input type="text" name="goodsstatus" placeholder="Enter The Status of Parcel" />

<p><input name="submit" type="submit" value="Submit" /></p>

</form>
<p style="color:#FF0000;"><?php echo $status; ?></p>

<br /><br /><br /><br />





</div>
</div>
</body>
</html>
<? ob_flush(); ?>