-
Notifications
You must be signed in to change notification settings - Fork 2
/
edittask_admin.php
99 lines (98 loc) · 4.61 KB
/
edittask_admin.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
<?php
include("inc/adminheader.php");
include("incdata/connection_edittask_admin.php");
?>
<?php
$dbconn = pg_connect("host=localhost port=5432 dbname=taskoo user=postgres password=tessa")
or die('Could not connect: ' . pg_last_error());
$query = "SELECT title, location, taskdate, timerange, price, description, category, helper FROM taskoo_task
WHERE taskid=". $_GET["taskid"].";";
$result = pg_query($query) or die('Query failed: ' . pg_last_error());
$row = pg_fetch_row($result);
pg_free_result($result);
pg_close($dbconn);
?>
<form method="POST" action="">
<div class="row">
<div class="col s1"></div>
<div class="col s4"><br><br><br>
<h5>Select Category</h5><br><br>
<label>
<input type="radio" name="category" <?php if ($row[6] == "cleaning") { echo "checked='checked'";}?> value="cleaning" required/>
<img src="../img/btn-cleaning.jpg" height=160px>
</label>
<label>
<input type="radio" name="category" <?php if ($row[6] == "errands") { echo "checked='checked'";}?> value="errands" />
<img src="../img/btn-errands.jpg" height=160px>
</label><br><br>
<label>
<input type="radio" name="category" <?php if ($row[6] == "moving") { echo "checked='checked'";}?> value="moving" />
<img src="../img/btn-moving.jpg" height=160px>
</label>
<label>
<input type="radio" name="category" <?php if ($row[6] == "virtual") { echo "checked='checked'";}?> value="virtual" />
<img src="../img/btn-virtual.jpg" height=160px>
</label><br><br>
<label>
<input type="radio" name="category" <?php if ($row[6] == "furniture") { echo "checked='checked'";}?> value="furniture" />
<img src="../img/btn-furniture.jpg" height=160px>
</label>
<label>
<input type="radio" name="category"<?php if ($row[6] == "handyman") { echo "checked='checked'";}?> value="handyman" />
<img src="../img/btn-handyman.jpg" height=160px>
</label><br><br>
</div>
<div class="col s5"><br><br><br>
<h5>Edit Task</h5><br><br>
<div class="row">
<div class="input-field col s12">
<input id="title" type="text" name="title" class="validate" value="<?php echo $row[0];?>" required>
<label for="title" class="active">Title</label>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<textarea id="textarea1" name="description" class="materialize-textarea"><?php echo $row[5];?></textarea>
<label for="textarea1" class="active">Task Description</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<input type="date" name="taskdate" class="datepicker">
<label for="date"></label>
</div>
<div class="input-field col s6">
<select name="timerange" required>
<option disabled>Select Time Range</option>
<option name="timerange" value="morning" <?php if ($row[3] == "morning") {echo "selected";};?>>Morning</option>
<option name="timerange" value="afternoon" <?php if ($row[3] == "afternoon") {echo "selected";};?>>Afternoon</option>
<option name="timerange" value="evening" <?php if ($row[3] == "evening") {echo "selected";};?>>Evening</option>
<option name="timerange" value="any time" <?php if ($row[3] == "any time") {echo "selected";};?>>Any Time</option>
</select>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<input id="location" type="text" name="location" class="validate" value="<?php echo $row[1];?>" required>
<label for="location" class="active">Location</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<input id="price" type="number" name="price" class="validate" value="<?php echo $row[4];?>" required>
<label for="price">Price ($/hr)</label>
</div>
<div class="input-field col s6">
<input id="helper" type="email" name="helperemail" class="validate" value="<?php echo $row[7];?>" required>
<label for="helper">Helper Email</label>
</div>
<input type="hidden" name="taskid" value='<?php echo $_GET["taskid"];?>'>
</div>
<br>
<button class="btn waves-effect waves-light" type="submit" name="action" style="float: right;">Update</button>
<a href="admindashboard.php" class="waves-effect waves-teal btn inbtn">Back</a>
</div>
<div class="col s1"></div>
</div><br><br>
</form><br>
<?php include("inc/footer.php"); ?>