-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstrongweak.php
134 lines (119 loc) · 3.71 KB
/
strongweak.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
session_start();
include("header.php");
include("connection.php");
include("surveyheader.php");
$dt = date("Y-m-d h:i:s");
for($k=0; $k<7; $k++)
{
$strong[$k] = $k;
$weak[$k] = $k;
}
if(isset($_POST["Update"]))
{
$serialized_data = serialize(array("$_POST[strong0]","$_POST[strong1]", "$_POST[strong2]", "$_POST[strong3]", "$_POST[strong4]", "$_POST[strong5]", "$_POST[strong6]"));
$serialized_data1 = serialize(array("$_POST[weak0]","$_POST[weak1]", "$_POST[weak2]", "$_POST[weak3]", "$_POST[weak4]", "$_POST[weak5]", "$_POST[weak6]"));
$resschool3 = mysqli_query($con,"select * from adv_disadv where surveyno='$surveyno'");
$counts = mysqli_num_rows($resschool3);
if($counts == 1)
{
mysqli_query($con,"UPDATE adv_disadv SET strong_point='$serialized_data',weak_point='$serialized_data1',lastupdate='$dt' where surveyno='$surveyno'");
if(mysqli_affected_rows($con) == 1)
{
$recres = "record updated successfully...";
}
}
else
{
$sql7="INSERT INTO adv_disadv(surveyno,strong_point,weak_point,lastupdate) VALUES ('$surveyno','$serialized_data','$serialized_data1','$dt')";
if (!mysqli_query($con,$sql7,$con))
{
die('Errors: ' . mysqli_error($con));
}
if(mysqli_affected_rows($con) == 1)
{
$recres = "record inserted successfully...";
}
}
}
$resschool4 = mysqli_query($con,"select * from adv_disadv where surveyno='$surveyno'");
$counts4 = mysqli_num_rows($resschool4);
while($row4 = mysqli_fetch_array($resschool4))
{
$surveynou = $row4[surveyno];
$strong = unserialize($row4[strong_point]);
$weak = unserialize($row4[weak_point]);
}
//Display school records
$query = "SELECT * FROM institute";
$result = mysqli_query($con,$query);
?>
<div id="main">
<div id="content" class="left">
<div class="highlight">
<h3> Strong Points & Weak Points</h3>
<form id="form1" name="form1" method="post" action="">
<table width="569" height="153" border="1">
<tr>
<th colspan="3" scope="row"> <?php echo $recres; ?></th>
</tr>
<tr>
<th width="53" scope="row">SL No.</th>
<th width="311" scope="row"><strong>Strong points</strong></th>
<td width="423"><strong> Weak points</strong></td>
</tr>
<?php
$j=0;
for($i=0; $i< 7; $i++)
{
?>
<tr>
<td > <?php echo $i+1; ?></td>
<td height="62" >
<textarea name="strong<?php echo $i; ?>" id="strong<?php echo $i; ?>" cols="30" rows="3"><?php echo $strong[$j] ; ?></textarea></td>
<td>
<textarea name="weak<?php echo $i; ?>" id="weak<?php echo $i; ?>" cols="30" rows="3"><?php echo $weak[$j] ; ?></textarea></td>
</tr>
<?php
$j = $j+1;
}
?>
<tr>
<th scope="row"> </th>
<th scope="row"> </th>
<td>
<?php
if($contsurvey == 1)
{
?><input type="submit" name="Update" id="Update" value="Update" />
<?php
}
else
{
echo "Survey is deactivated";
}
?></td>
</tr>
</table>
</form>
<p> </p>
</div>
<div class="projects">
<div class="item"></div>
<div class="item">
<div class="cl"> </div>
</div>
</div>
</div>
<div id="sidebar" class="right">
<?php include("sidebar.php"); ?>
</div>
<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");
?>