-
Notifications
You must be signed in to change notification settings - Fork 0
/
editawards.php
144 lines (121 loc) · 3.66 KB
/
editawards.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
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width-device-width, initial-scale=1.0">
<!-- <tilte><h4>Register Here</h4></tilte>-->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/ideacss.css" rel="stylesheet">
<script type="text/javascript">
function validateform(){
if (document.form1.name.value == "")
{
alert("Please enter the Name");
document.form1.name.focus();
return false;
}
if (document.form1.level.value == "")
{
alert("Please enter the Badge Level");
document.form1.level.focus();
return false;
}
if (document.form1.postcount.value == "")
{
alert("Please enter the Postcount Relate to the badge");
document.form1.postcount.focus();
return false;
}
if (document.form1.dis.value == "")
{
alert("Please enter a brief description");
document.form1.dis.focus();
return false;
}
return true;
}
</script>
</head>
<body background="images/body.jpg">
<?php
session_start();
include("database_connect.php");
if(mysqli_connect_errno()){
echo "failed to connect to MySQL.".mysqli_connect_error();
}
if ( isset($_GET['sendId'])){
$editaw= $_GET['sendId'];
$_SESSION['edit']=$editaw;
$sendID = $_GET['sendId'];
echo "<script> window.postid = ".$sendID." </script>";
$result=mysqli_query($con,"Select * from reward where id='".$sendID."' ");
if (!$result) {
printf("Error: %s\n", mysqli_error($con));
exit();
}
while($row=mysqli_fetch_array($result)){
$_SESSION['imagepath'] = $row['img'];
include('header.php');
?>
<div class="container">
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title" align="center">Add a new Award</h4>
</div>
<div class="panel-body">
<form name="form1" method="POST" action="editAwards_form.php" onSubmit="return validateform();" enctype="multipart/form-data">
<div class="form-group">
<label for="addr">Name</label>
<input type="text" class="form-control" name="name" value="<?php echo $row['name'] ?>">
</div>
<?php $instruction = $row['type'];
?>
<div class="form-group">
<label for="fnam">Type</label>
<select name="type">
<option value="Improvement" <?php if (!empty($instruction) && $instruction == 'Improvement') echo 'selected = "selected"'; ?>>Improvement</option>
<option value="vote" <?php if (!empty($instruction) && $instruction == 'vote') echo 'selected = "selected"'; ?>>Vote</option>
<option value="submission" <?php if (!empty($instruction) && $instruction == 'submission') echo 'selected = "selected"'; ?>>Submission</option>
</select>
</div>
<div class="form-group">
<label for="lnam">Level</label>
<input type="text" class="form-control" name="level" value="<?php echo $row['level'] ?>">
</div>
<div class="form-group">
<label for="post">Postcount</label>
<input type="text" class="form-control" name="postcount" value="<?php echo $row['postcount'] ?>">
</div>
<div class="form-group">
<label for="dis">Description</label>
<input type="text" class="form-control" name="dis" value="<?php echo $row['description'] ?>">
</div>
<div class="form-group">
<label for="input">Upload Award</label>
<input type="file" name="input"/>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary" value="submit">Edit </button>
<button type="" class="btn btn-primary" value="">Cancel </button>
</div>
<input type="hidden" name="postid" value="<?php echo $row['id']; ?>">
</form>
<?php }
} ?>
</div>
</div>
</div>
<div class="col-md-3">
</div>
</div>
</div>
</body>
<?php
include('footer.php');
?>
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
</html>