-
Notifications
You must be signed in to change notification settings - Fork 0
/
editSupplier_saveDatabase.php
76 lines (64 loc) · 2.23 KB
/
editSupplier_saveDatabase.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Αποθήκευση στη Βάση</title>
</head>
<body>
<?php
session_start();
$error_edit_supplier = "";
$ok_edit_supplier = "";
$servername = "localhost";
$username = "cyfoodmuseum";
$password = "9m8ESxZD";
$dbname = "cyfoodmuseum";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if (!$conn->set_charset("utf8")) {
printf("Error loading character set utf8: %s\n", $conn->error);
die;
}
parse_url(file_get_contents("php://input"), $_POST);
$CodeSupplier = $_SESSION['supplier'];
$name = $_POST['name'];
$til = $_POST['til'];
$fax = $_POST['fax'];
$d1 = $_POST['d1'];
$d2 = $_POST['d2'];
$city = $_POST['city'];
$tk = $_POST['tk'];
$site = $_POST['site'];
$email = $_POST['email'];
$_SESSION['supplier'] = $CodeSupplier;
$_SESSION['Sname'] = $name;
$_SESSION['til'] = $til;
$_SESSION['a1'] = $d1;
$_SESSION['a2'] = $d2;
$_SESSION['city'] = $city;
$_SESSION['tk'] = $tk;
$_SESSION['email'] = $email;
$_SESSION['site'] = $site;
$_SESSION['fax'] = $fax;
$_SESSION['error_edit_supplier'] = " ";
$sql="UPDATE `SUPPLIER` SET CompanyName='$name', Address1='$d1', Address2 = '$d2', City= '$city', PostalCode = '$tk', TelephoneNumber= '$til', email = '$email', site = '$site', fax = '$fax' WHERE SupplierNumber='$CodeSupplier'";
$_SESSION['ok_edit_supplier'] = " ";
if ($conn->query($sql) === TRUE){
$ok_edit_supplier = "Η επεξεργασία του προμηθευτή ολοκληρώθηκε επιτυχώς!";
$_SESSION['ok_edit_supplier'] = $ok_edit_supplier;
mysqli_close($conn);
header("Location:editSupplier.php");
die;
}
$error_edit_supplier = "Η επεξεργασία του προμηθευτή δεν ολοκληρώθηκε επιτυχώς!";
$_SESSION['error_edit_supplier'] = $error_edit_supplier;
mysqli_close($conn);
header("Location:editSupplier.php");
die;
?>
</body>
</html>