/
editProfile.php
190 lines (175 loc) · 9.46 KB
/
editProfile.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?php
require_once("config.php");
require_once("functions.php");
global $loggedInUser;
if (isUserLoggedIn()) {
$profile_id = $_GET['profileid'];
$ThisUserId = $loggedInUser->user_id;
$thisProfile = fetchProfile($profile_id);
/* ?>
<pre><?php
print_r($thisProfile);
?></pre>
<?php */
//echo $thisProfile[0]['profileid'];
if (!empty($_POST)) {
$errors = array();
$profile_name = trim($_POST["profile_name"]);
$team = trim($_POST["team"]);
$position = trim($_POST["position"]);
$college = trim($_POST["college"]);
$age = trim($_POST["age"]);
$height = trim($_POST["height"]);
$weight = trim($_POST["weight"]);
$gender = trim($_POST["gender"]);
$sport = trim($_POST["sport"]);
$location = trim($_POST["location"]);
$howoften = trim($_POST["howoften"]);
$experience = trim($_POST["experience"]);
$play_status = trim($_POST["play_status"]);
$achivement_1 = trim($_POST["achivement_1"]);
$achivement_2 = trim($_POST["achivement_2"]);
$achivement_3 = trim($_POST["achivement_3"]);
$achivement_4 = trim($_POST["achivement_4"]);
$achivement_5 = trim($_POST["achivement_5"]);
$profile = EditProfile($profile_name, $age, $height, $weight, $gender, $sport, $location, $howoften, $team, $position, $college, $experience, $play_status, $profile_id, $achivement_1, $achivement_2, $achivement_3, $achivement_4, $achivement_5);
// echo "user name created";
// print_r($errors);
if ($profile == 1) {
header("Location: index.php");
}
// }
/* if (count($errors) == 0) {
$successes[] = "registration successful";
echo count($errors);
} */
}
} else {
header("Location: login.php");
die();
}
require_once("head.php");
require_once("header.php");
?>
<div class="container-fluid">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 m-auto profile">
<fieldset>
<legend class="profile-tag">
<h1>Edit your Profile</h1>
</legend>
<form id="profileform" action="<?php $_SERVER["PHP_SELF"]; ?>" method="post">
<div class="profile-data">
<div class="row my-5">
<div class="col-lg-3 col-md-3 col-sm-12">
<div class="imageProfileText mb-4">
Profile Image
</div>
<div class="upload-image">
<input type='file' name='eventImage' class="imageInput">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12">
<table>
<tr>
<th>Profile Name</th>
<td> <input type="text" id="profile_name" name="profile_name" value="<?php print $thisProfile[0]['profilename'] ?>" class="form-control mb-0" placeholder="Save Profile Name">
</td>
</tr>
<tr>
<th>Team</th>
<td> <input type="text" id="team" name="team" value="<?php print $thisProfile[0]['team'] ?>" class="form-control mb-0" placeholder="Team you play for?">
</td>
</tr>
<tr>
<th>Position</th>
<td> <input type="text" id="position" name="position" value="<?php print $thisProfile[0]['position'] ?>" class="form-control mb-0" placeholder="Position you play?">
</td>
</tr>
<tr>
<th>College</th>
<td> <input type="text" id="college" name="college" value="<?php print $thisProfile[0]['college'] ?>" class="form-control mb-0" placeholder="College name">
</td>
</tr>
<tr>
<th>Age</th>
<td> <input type="text" id="age" name="age" value="<?php print $thisProfile[0]['age'] ?>" class="form-control mb-0" placeholder="Your Age">
</td>
</tr>
<tr>
<th>Height</th>
<td> <input type="text" id="height" name="height" value="<?php print $thisProfile[0]['height'] ?>" class="form-control mb-0" placeholder="Your Height">
</td>
</tr>
<tr>
<th>Weight</th>
<td> <input type="text" id="weight" name="weight" value="<?php print $thisProfile[0]['weight'] ?>" class="form-control mb-0" placeholder="Your Weight">
</td>
</tr>
<tr>
<th>Gender</th>
<td> <input type="radio" name="gender" value="male" checked> Male
<input type="radio" class="ml-3" name="gender" value="female"> Female
<input type="radio" class="ml-3" name="gender" value="other"> Other
</td>
</tr>
</table>
</div>
<div class="col-lg-5 col-md-5 col-sm-12">
<table>
<tr>
<th>What You Play</th>
<td> <select name=sport>
<option value="Football">Football</option>
<option value="Basketball">Basket Ball</option>
<option value="Soccer">Soccer</option>
<option value="Rugby">Rugby</option>
</select>
</td>
</tr>
<tr>
<th>Location</th>
<td> <input type="text" id="location" name="location" value="<?php print $thisProfile[0]['location'] ?>" class="form-control mb-0" placeholder="Where are you located">
</td>
</tr>
<tr>
<th>How often you play</th>
<td> <input type="text" id="howoften" name="howoften" value="<?php print $thisProfile[0]['location'] ?>" class="form-control mb-0" placeholder="How often you play">
</td>
</tr>
<tr>
<th>Experience</th>
<td> <input type="text" id="experience" name="experience" value="<?php print $thisProfile[0]['experience'] ?>" class="form-control mb-0" placeholder="How much experience">
</td>
</tr>
<tr>
<th>Playing Status</th>
<td> <input type="radio" name="play_status" value="Active" checked> Active
<input type="radio" class="ml-5" name="play_status" value="Inactive"> Inactive
</td>
</tr>
</table>
</div>
</div>
<div class="button">
<button type="submit" id="submit" class="btn-width" name="submit">Update
<i class="fas fa-server" aria-hidden="true"></i>
</button>
</div>
<div class="col-lg-12 col-md-12 col-sm-4 col-sm-4 m-auto">
<div class="or or-edit">OR</div>
</div>
<div class="button abutton register-button">
<a href="delete_profile.php?pro_id=<?php print $thisProfile[0]['profileid'] ?>" class="">Delete Profile
<i class="fas fa-user-plus" aria-hidden="true"></i>
</a>
</div>
</div>
</form>
</fieldset>
</div>
</div>
</div>
<?php
require_once("footer.php");
?>