-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathviewupdateprof.php
138 lines (130 loc) · 3.63 KB
/
viewupdateprof.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
<?php
session_start();
include("header.php");
include("connection.php");
$dt = date("Y-m-d");
?>
<script type="text/JavaScript">
function confirmDelete(){
var agree=confirm("Are you sure you want to delete this file?");
if (agree)
return true;
else
return false ;
}
</script>
<?php
if(isset($_POST["update2"]))
{
mysqli_query($con,"DELETE FROM updates where upda_id='$_POST[profileid]'");
$upmessage = "Record deleted successfully...";
}
if(isset($_POST["update"]))
{
mysqli_query($con,"UPDATE updates SET title='$_POST[title]',descr='$_POST[description]',date='$_POST[date]',time='$_POST[time]',type='$_POST[time]' WHERE upda_id='$_POST[profileid]'");
if(mysqli_affected_rows($con) == 1)
{
$upmessage = "Record updated successfully...";
}
}
if(isset($_POST["update"]))
{
$result = mysqli_query($con,"SELECT * FROM updates where upda_id = '$_POST[profileid]'");
}
else
{
$result = mysqli_query($con,"SELECT * FROM updates where upda_id = '$_GET[proid]'");
}
while($row = mysqli_fetch_array($result))
{
$title = $row['title'];
$descr=$row['descr'];
$date=$row['date'];
$time=$row['time'];
$type =$row['type'];
}
?>
<div id="main">
<div id="content" class="left">
<div class="highlight">
<h3> </h3>
<strong><a href="viewnews.php">View News</a></strong>
<form id="form1" name="form1" method="post" action="">
<p><?php echo $upmessage; ?></p>
<p>
<?php
if($upmessage == "Record deleted successfully...")
{
echo "<p><b><a href='viewnews.php'>Back</b></p>";
}
else
{
?>
<table width="450" border="0">
<tr>
<td width="93"><input value="<?php echo $_GET[proid]; ?>" name="profileid" type="hidden" id="profileid" />Title</td>
<td width="350"><input value="<?php echo $title; ?>" name="title" type="text" id="title" size="50" /></td>
</tr>
<tr>
<td><label for="institutetype3">Description</label></td>
<td><textarea name="description" id="description" cols="45" rows="5"><?php echo $descr; ?></textarea></td>
</tr>
<tr>
<td>Date</td>
<td><input type="text" value="<?php echo $date; ?>" name="date" id="date" /></td>
</tr>
<tr>
<td>Time</td>
<td><input name="time" value="<?php echo $time; ?>" type="text" id="time" size="25" /></td>
</tr>
<tr>
<td>Type
<label for="type2"></label></td>
<td><select name="type" id="type">
<option value="news" <?php
if($type == "news")
{
echo " selected";
}
?>>News & Updates</option>
<option value="events" <?php
if($type == "events")
{
echo " selected";
}
?>>Events</option>
</select></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="update" id="update" value="Update" />
<input type="submit" name="update2" id="update2" value="Delete" onClick='return confirmDelete();'/></td>
</tr>
</table>
</form>
<?php
}
?> <p> </p>
</div>
<div class="projects">
<div class="item"></div>
<div class="item">
<div class="cl"> </div>
</div>
</div>
</div>
<?php
include("sidebar.php");
?>
<div class="cl"> </div>
</div>
<div class="shadow-l"></div>
<div class="shadow-r"></div>
<div class="shadow-b"></div>
</div>
<?php
include("footer.php");
?>