-
Notifications
You must be signed in to change notification settings - Fork 0
/
editmodules.php
76 lines (63 loc) · 2.21 KB
/
editmodules.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
<?php
include 'header.php';
include 'sidebar.php';
include 'subHeader.php';
if(isset($_GET['id'])){
$ID=$_GET['id'];
$edit = $connect->query("SELECT * FROM modules_record where module_id='$ID'");
foreach($edit as $editmodule);
}
?>
<?php
//include 'connect.php';
if(isset($_POST['SubmitUpdate'])){
$id = $_POST['EditedId'];
echo $id;
$MoName = $_POST["MoName"];
$MCode = $_POST["MCode"];
$CId = $_POST["CId"];
$TId = $_POST["TId"];
$statement="update modules_record set module_name='".$MoName."', module_code='".$MoCode."', course_id='".$CId."', tutor_id='".$TId."' where module_id=".$id;
echo $statement;
$update_module = $connect->query($statement);
if($update_module){
echo "<script>alert('updated! Successfully')</script>";
echo "<script>window.open('modules.php','_self')</script>";
}
}
?>
<div id="page-wrapper">
<div class="main-page">
<div class="forms">
<h2 class="title1">Forms</h2>
<div class="form-grids row widget-shadow" data-example-id="basic-forms">
<div class="form-title">
<h4>Edit Modules:</h4>
</div>
<form action="" method="post">
<fieldset>
<span class="FieldInfo">Module Name:</span>
<br>
<input type="text" name="MoName" value=<?php echo $editmodule['module_name']; ?>>
<br>
<span class="FieldInfo">Module Code:</span><br>
<input type="text" name="MoCode" value=<?php echo $editmodule['module_code']; ?>>
<br>
<span class="FieldInfo">Course Id:</span><br>
<input type="text" name="CId" value=<?php echo $editmodule['course_id']; ?>>
<br>
<span class="FieldInfo">Tutor Id:</span><br>
<input type="text" name="TId" value=<?php echo $editmodule['tutor_id']; ?>>
<br>
<input type="text" name="EditedId" value="<?php echo $ID ?>"/>
<br>
<input type="submit" name="SubmitUpdate" value="Update">
<br>
</fieldset>
</form>
<a href="modules.php" class="btn">Back</a>
</div>
</div>
</div>
</div>
<?php include 'footer.php'; ?>