-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedited.php
More file actions
60 lines (49 loc) · 1.77 KB
/
Copy pathedited.php
File metadata and controls
60 lines (49 loc) · 1.77 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
<html>
<head>
<title>Edit Data</title>
</head>
<body>
<?php
include "includes/header.php";
include_once("config.php");
if(isset($_POST['Submit'])) {
$id = mysqli_real_escape_string($mysqli, $_POST['id']);
$title = mysqli_real_escape_string($mysqli, $_POST['title']);
$fname = mysqli_real_escape_string($mysqli, $_POST['fname']);
$lname = mysqli_real_escape_string($mysqli, $_POST['lname']);
$address = mysqli_real_escape_string($mysqli, $_POST['address']);
$town = mysqli_real_escape_string($mysqli, $_POST['town']);
$zip = mysqli_real_escape_string($mysqli, $_POST['zip']);
$phone = mysqli_real_escape_string($mysqli, $_POST['phone']);
if(empty($title) || empty($fname) || empty($lname) || empty($address) || empty($town) || empty($zip) || empty($phone)) {
if(empty($title)) {
echo "<font color='red'>Name field is empty.</font><br/>";
}
if(empty($fname)) {
echo "<font color='red'>Age field is empty.</font><br/>";
}
if(empty($lname)) {
echo "<font color='red'>Email field is empty.</font><br/>";
}
if(empty($address)) {
echo "<font color='red'>Name field is empty.</font><br/>";
}
if(empty($town)) {
echo "<font color='red'>Age field is empty.</font><br/>";
}
if(empty($zip)) {
echo "<font color='red'>Email field is empty.</font><br/>";
}
if(empty($phone)) {
echo "<font color='red'>Email field is empty.</font><br/>";
}
echo "<br/><a href='javascript:self.history.back();'>Go Back</a>";
} else {
$result = mysqli_query($mysqli, "UPDATE customers SET title= '$title', fname = '$fname', lname='$lname', address='$address', town='$town', zip='$zip', phone='$phone' WHERE id=$id");
echo "<font color='green'>Data added successfully.";
echo "<br/><a href='index.php'>View Result</a>";
}
}
?>
</body>
</html>