forked from ateam6544/2019-Team-6544-Scouting-App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditTeam.php
134 lines (125 loc) · 4.45 KB
/
editTeam.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
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
124
125
126
127
128
129
130
131
132
133
134
<?php include('includes/database.php'); ?>
<?php
//Assign get variable
$user = null;
$scouter = null;
if(isset($_GET['u'])) {
$user = $_GET['u'];
$scouter = $_GET['s'];
}
$id = $_GET['id'];
//Create customer select query
$query ="SELECT * FROM team_info
WHERE team_info.id = $id";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
if($result = $mysqli->query($query)){
//Fetch object array
while($row = $result->fetch_assoc()) {
$teamName = $row['teamName'];
$teamNumber = $row['teamNumber'];
$teamSchoolName = $row['teamSchoolName'];
$teamEmail = $row['teamEmail'];
$teamAge = $row['teamAge'];
$teamLocation = $row['teamLocation'];
}
//Free Result set
$result->close();
}
?>
<?php
if($_POST){
//Assign GET Variable
$id = $_GET['id'];
//Assign Variables
$teamName = ($_POST['teamName']);
$teamNumber = ($_POST['teamNumber']);
$teamSchoolName = ($_POST['teamSchoolName']);
$teamEmail = ($_POST['teamEmail']);
$teamAge = ($_POST['teamAge']);
$teamLocation = ($_POST['teamLocation']);
//Create customer update
$query = "UPDATE team_info
SET
teamName='$teamName',
teamNumber='$teamNumber',
teamSchoolName='$teamSchoolName',
teamEmail='$teamEmail',
teamLocation='$teamLocation',
teamAge='$teamAge'
WHERE id=$id
";
$mysqli->query($query) or die();
$msg="Team Updated";
header('Location:teamList.php?msg='.urlencode($msg).'');
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>A-Team Robotics Scouting Page</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<link href="css/main.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/custom.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="header">
<h3 style="color:purple; font:bold;">A-Team Scouting Page</h3>
<ul class="nav nav-pills pull-right">
<li ><a href="teamList.php?u=<?php echo $user; ?>&s=<?php echo $scouter; ?>">Team List</a></li>
<li class="active"><a href="editTeam.php?u=<?php echo $user; ?>&s=<?php echo $scouter; ?>">Edit Team</a></li>
</ul>
</div>
<div class="row marketing">
<div class="col-lg-12">
<h2>Edit Team</h2>
<form role="form" method="post" action="editTeam.php?id=<?php echo $id; ?>">
<div class="form-group">
<label>Team Name</label>
<input name="teamName" type="text" class="form-control" value="<?php echo $teamName; ?>"placeholder="Enter Team Name" required>
</div>
<div class="form-group">
<label>Team Number</label>
<input name="teamNumber" type="text" class="form-control" value="<?php echo $teamNumber; ?>"placeholder="Enter Last Name" required>
</div>
<div class="form-group">
<label>Team School Name</label>
<input name="teamSchoolName" type="text" class="form-control" value="<?php echo $teamSchoolName ?>"placeholder="Enter School Name">
</div>
<div class="form-group">
<label>Team Email</label>
<input name="teamEmail" type="email" class="form-control" value="<?php echo $teamEmail ?>"placeholder="Enter Email">
</div>
<div class="form-group">
<label>Team Age</label>
<input name="teamAge" type="text" class="form-control" value="<?php echo $teamAge ?>"placeholder="Enter Age">
</div>
<div class="form-group">
<label>Team Location</label>
<input name="teamLocation" type="text" class="form-control" value="<?php echo $teamLocation ?>"placeholder="Enter Team Location">
</div>
<br><input type="submit" class="btn btn-default" value="Submit Changes" /></br>
</form>
</div>
</div>
<div>
<form action="delete.php" method="get">
<p><input type="checkbox" name="Team" value="<?php echo $id ?>">Delete: <?php echo $teamName ?></p>
<input type="submit" value="Delete">
</form>
</div>
<div class="footer">
<p style="color:purple;">© A-Team Robotics 2018</p>
</div>
</div> <!-- /container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
</body>
</html>