<html>
<head>
<title> Rental Added </title>
</head>
<body>
<server>
if(request.videoID != null)
{
  client.videoID = request.videoID;
}

if(request.customerID != null)
{
  client.customerID = request.customerID;
}

if(client.videoID != null && client.customerID != null)
{
  cursor = database.cursor("select * from rentals", true);
  cursor.next();
  cursor.customerid = client.customerID;
  cursor.videoid = client.videoID;
  cursor.invoicenum = 42;
  today = new Date();
  cursor.rentaldate = today;
  duedate = new Date();
  duedate.setDate(today.getDate() + 3);
  duedate.setHours(23);
  duedate.setMinutes(0);
  duedate.setSeconds(0);
  cursor.duedate = duedate;
  cursor.returndate = null;
  cursor.insertRow("rentals");
  cursor.close();

  redirect("status.html");
}    
else if(client.customerID == null)
{
  redirect("client.html");
}
else
{
  redirect("videos.html");
}
</server>
</body>
</html>
