-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassetupdate.php
More file actions
123 lines (92 loc) · 3.12 KB
/
assetupdate.php
File metadata and controls
123 lines (92 loc) · 3.12 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
session_start();
include('header.php');
include_once("db_connect.php");
if (!empty($_POST["newUser_ID"])) {
$newUser_ID = $_POST["newUser_ID"];
mysqli_query($conn, "Update assets SET user_id = '".$newUser_ID."' WHERE asset_id = '" . $aID. "' ");
}
if (!empty($_GET)){
$aID = (int) $_GET['id'];
}
$result = mysqli_query($conn, "SELECT * FROM assets left OUTER join users using (user_id) WHERE asset_id = '" . $aID. "' ");
$row = mysqli_fetch_array($result);
$aSid = $row['asset_id'];
$serialnumber = $row['serialnumber'];
$userID = $row['user_id'];
$userType = $row['userType'];
$firstname = $row['firstname'];
$middle = $row['middle'];
$lastname = $row['lastname'];
$email = $row['email'];
$title = $row['title'];
$managed_byID = $row['managed_by'];
$dept_id = $row['dept_id'];
$location_id = $row['location_id'];
$primary_phone = $row['primary_phone'];
$price = $row['unit_price'];
$rental= $row['monthly_rental_price'];
$status = $row['asset_status'];
$assignto = $firstname." ".$lastname;
?>
<head>
<link rel="stylesheet" href="css/style.css">
</head>
<div class="main-page">
<div class="form">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" >
<fieldset>
<legend>Asset Information</legend>
<table align=left>
<tr>
<td>Asset ID:</td>
<td><?php echo $aID ?></td>
</tr>
<tr>
<td>Asset Status:</td>
<td><?php echo $status ?></td>
</tr>
<tr>
<td>Serial Number:</td>
<td><?php echo $serialnumber ?></td>
</tr>
<tr>
<td>Unit Price:</td>
<td><?php echo $price ?></td>
</tr>
<tr>
<td>Rental Price:</td>
<td><?php echo $rental ?></td>
</tr>
<tr>
<td>Asset Assgined To:</td>
<td>
<select name="newUser_ID" ng-required="true">
<option value="">Select</option>
<?php
include_once("../db_connect.php");
//delcare var and set its value to sql query
$sqli = "SELECT * FROM users";
$result = mysqli_query($conn, $sqli);
while ($row = mysqli_fetch_array($result)) {
$user = trim($row['firstname']. " " .$row['lastname']);
$uid = $row['user_id'];
echo "<option value='$uid'>$user</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td>Email:</td>
<td><?php echo $email ?></td>
</tr>
<tr>
<td>Title:</td>
<td><?php echo $title ?></td>
</tr>
</table>
</fieldset>
<button type="submit" name="search">Update</button>
<form>
</div>