Repository navigation
Expand file tree
/
Copy pathcategory.php
More file actions
143 lines (126 loc) · 3.94 KB
/
Copy pathcategory.php
File metadata and controls
143 lines (126 loc) · 3.94 KB
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
<?php
include("header.php");
if(isset($_POST['submit']))
{
if(isset($_GET['editid']))
{
//Update statement starts here
$sql = "UPDATE newscategory SET category='$_POST[category]',description='$_POST[description]',status='$_POST[status]' WHERE newscategoryid='$_GET[editid]'";
$qsql = mysqli_query($con,$sql);
echo mysqli_error($con);
if(mysqli_affected_rows($con) ==1)
{
echo "<script>alert('News category record updated successfully..');</script>";
echo "<script>window.location='category.php?type=$_GET[type]&editid=$_GET[editid]';</script>";
}
//Update statement ends here
}
else
{
//Insert News category Record starts here
$sql = "INSERT INTO newscategory(category,description,status,category_type) VALUES('$_POST[category]','$_POST[description]','$_POST[status]','$_GET[type]')";
$qsql = mysqli_query($con,$sql);
echo mysqli_error($con);
if(mysqli_affected_rows($con) ==1)
{
echo "<script>alert('" . $_GET['type'] . " Category record inserted successfully..');</script>";
echo "<script>window.location='category.php?type=$_GET[type]';</script>";
}
//Insert News category Record Ends here
}
}
//2 - Selecting the record starts here..
if(isset($_GET['editid']))
{
$sqledit = "SELECT * FROM newscategory WHERE newscategoryid='$_GET[editid]'";
$qsqledit = mysqli_query($con,$sqledit);
$rsedit = mysqli_fetch_array($qsqledit);
}
// 2 - Select the record ends here..
?>
<!-- catg header banner section -->
<section id="aa-catg-head-banner">
<div class="aa-catg-head-banner-area">
<div class="container">
<div class="aa-catg-head-banner-content">
<h2>article Category</h2>
</div>
</div>
</div>
</section>
<!-- / catg header banner section -->
<!-- Cart view section -->
<section id="checkout">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="checkout-area">
<form action="" method="post">
<div class="row">
<?php
include("sidebar.php");
?>
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="panel panel-info">
<div class="panel-heading"><?php echo $_GET['type']; ?> Category</div>
<div class="panel-body">
<div class="row">
<div class="col-md-12" style="padding-bottom: 10px;">
<div class="aa-checkout-single-bill">
Category:
<input type="text" name="category" value="<?php echo $rsedit['category']; ?>" placeholder="Category" class="form-control">
</div>
</div>
<div class="col-md-12" style="padding-bottom: 10px;">
<div class="aa-checkout-single-bill">
Description:
<textarea name="description" placeholder="Description" class="form-control"><?php echo $rsedit['description']; ?></textarea>
</div>
</div>
<div class="col-md-12" style="padding-bottom: 10px;">
<div class="aa-checkout-single-bill">
Status
<select placeholder="Status" name="status" class="form-control">
<option value="0">Select Status</option>
<?php
$arr = array("Active","Inactive");
foreach($arr as $val)
{
if($val == $rsedit['status'])
{
echo "<option selected value='$val'>$val</option>";
}
else
{
echo "<option value='$val'>$val</option>";
}
}
?>
</select>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="aa-checkout-single-bill col-md-12">
<hr>
<center><input type="submit" name="submit" value="Click here to Submit" class="aa-browse-btn"></center>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-2"></div>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
<!-- / Cart view section -->
<?php
include("footer.php");
?>