-
Notifications
You must be signed in to change notification settings - Fork 1
/
update.php
65 lines (64 loc) · 2.54 KB
/
update.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
<?php
session_start();
include 'connection.php';
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="style1.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<title>Form</title>
</head>
<?php
$id=$_GET['id'];
$query="SELECT * FROM info WHERE id='".$id."'";
$result = $db->query($query);
$followingdata = $result->fetch_assoc();
$title=$followingdata['title'];
$description=$followingdata['description'];
$Category=$followingdata['category'];
$keywords=$followingdata['keywords'];
?>
<body>
<form method="post" action="" enctype="multipart/form-data">
<div class="outline">
<div class="r1">
<h4><i class="fa fa-id-badge" style="font-size:24px"> </i> Add Info</h4><br>
<div class="r2">Title:-
<input type="text" name="title" placeholder="Enter your title" class="form-control" value="<?= $title?>">
</div>
<div class="form-group"> Description :-
<textarea class="form-control" name="description" placeholder="Enter Description"><?php echo"$description";?></textarea>
</div>
<div class="form-group">Select Category :-
<select name="Category" class="form-control" value="<?= $category?>">
<option value="OPEN" selected>OPEN</option>
<option value="OBC">OBC</option>
<option value="NT">NT</option>
<option value="OTHER">SC/ST</option>
</select>
</div>
<br>
<input type="file" name="image" id="image">
<br>Keywords:-
<input type="text" name="keywords" placeholder="Enter Keywords" class="form-control" value="<?= $keywords?>"><br>
<input type="submit" name="submit" value="UPDATE">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="style1.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<?php
if(isset($_POST['submit'])){
$title=$_POST['title'];
$description=$_POST['description'];
$Category=$_POST['Category'];
$keywords=$_POST['keywords'];
$image = $_FILES['image']['name'];
$file = addslashes(file_get_contents($_FILES['image']['tmp_name']));
$sql = "UPDATE info SET title='".$title."',description='".$description."',category='".$Category."',keywords='".$keywords."',image='".$file."' WHERE id='".$id."'";
$res1=mysqli_query($db,$sql);
header('location:info.php');
}
?>
<hr>
</div>