-
Notifications
You must be signed in to change notification settings - Fork 0
/
doaddbatt.php
executable file
·36 lines (36 loc) · 1.01 KB
/
doaddbatt.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
require "header.php";
$start = intval($_POST["start"]);
$end = $_POST["end"];
if ($end == "")
$end = $start;
else
$end = intval($end);
$makeid = intval($_POST["make"]);
$date_acquired = $_POST["acquired"];
require_once "connect.php";
$conn = connect();
$s = $conn->prepare("insert into battery(num, make_id, user_id, acquired) values(?, ?, ?, ?)") or die($conn->error);
for ($i=$start; $i<=$end ; $i++)
{
$s->bind_param("iiis", $i, $makeid, $userid, $date_acquired) or die($conn->error);
$s->execute() or die($conn->error);
}
$s->close();
$conn->close();
header("Location: main.php?message=".rawurlencode("Battery added successfully"));
die();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Add Batteries</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
</head>
<body>
There was an error for some reason...
</body>
</html>