-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.php
More file actions
26 lines (21 loc) · 755 Bytes
/
update.php
File metadata and controls
26 lines (21 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
include 'config.php';
$id=$_GET['id'];
$result=$link->query("select * from stud where id=$id");
$row=$result->fetch_assoc();
//update when form is sublitted
if(isset($_POST['update'])){
$name=$_POST['name'];
$email=$_POST['email'];
$address=$_POST['address'];
$link->query("UPDATE stud SET name='$name',email='$email',address='$address' where id=$id");
header ("location: show.php");
}
?>
<h2> update students</h2>
<form method="POST">
Name:<input type="text" name="name" value="<?=row['name']?>" required><br>
email:<input type="text" name="email" value="<?=row['email']?>" required><br>
address:<input type="text" name="address" value="<?=row['address']?>"required> <br>
<input type="submit" name="update" value="update">
</form>