-
Notifications
You must be signed in to change notification settings - Fork 1
/
edit.php
91 lines (69 loc) · 2.73 KB
/
edit.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
<?php
include 'connection.php';
$id = $_GET['id'];
$sql = "SELECT * FROM worddb WHERE id=$id";
$result = $conn->query($sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
$uniqueID = $row["id"];
$word = $row["word"];
$synonyms = $row["synonyms"];
$sentence = $row["sentence"];
}
} else {
echo "0 results";
}
mysqli_close($conn);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Word Project of Jakir</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/word.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
</body>
<div class="container">
<form class="form-signin" action="update.php" method="post">
<h2 class="form-signin-heading">Input the word</h2>
<label for="inputEmail" class="sr-only">Word</label>
<input type="text" id="word" name="word" class="form-control" placeholder="Enter Word" required autofocus>
<label for="Synonyms" class="sr-only">Synonyms</label>
<input type="text" id="synonyms" name="synonyms" class="form-control" placeholder="Enter Synonyms" required>
<label for="Sentence" class="sr-only">Sentence</label>
<textarea rows="4" cols="50" id="sentence" name="sentence" class="form-control" placeholder="Enter Relevent Sentence" ></textarea>
</br>
<input type="hidden" name="id" id="id" value="0">
<button class="btn btn-lg btn-primary btn-block" type="submit">Update Word</button> </br>
<a class="btn btn-success center-block" href="list.php" role="button">See All Words</a>
</form>
</div> <!-- /container -->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<script>
$(document).ready(function(){
$id = "<?php echo $id; ?>";
$("#id").val( $id );
$word = "<?php echo $word; ?>";
$("#word").val( $word );
$synonyms = "<?php echo $synonyms; ?>";
$("#synonyms").val( $synonyms );
$sentence = "<?php echo $sentence; ?>";
$("#sentence").val( $sentence );
});
</script>
</body>
</html>