-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtransactionAdd.php
More file actions
97 lines (83 loc) · 2.69 KB
/
transactionAdd.php
File metadata and controls
97 lines (83 loc) · 2.69 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
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
92
93
94
95
96
97
<!DOCTYPE html>
<html>
<body>
<?php
require "menu.php";
require 'connectToDB.php';
$id = $methp = $amp = "";
$error = "";
if(isset($_POST["submit"]))
{
//isset()
$id = isset($_POST['id']) ? $_POST['id'] : "";
//empty()
$id = !empty($_POST['id']) ? $_POST['id'] : "";
//isset()
$methp = isset($_POST['methp']) ? $_POST['methp'] : "";
//empty()
$methp = !empty($_POST['methp']) ? $_POST['methp'] : "";
//isset()
$amp = isset($_POST['amp']) ? $_POST['amp'] : "";
//empty()
$amp = !empty($_POST['amp']) ? $_POST['amp'] : "";
if(is_numeric($amp))
{
if(is_numeric($id))
{
$query = "INSERT INTO `transaction_history` VALUES ('$id','$methp','$amp')";
if (!mysqli_query($mysql_connection, $query)) {
$er = mysqli_error($mysql_connection);
$error = "<div class='alert alert-danger alert-dismissable fade in'>
<strong>$er<strong>.
</div>";
}
else
{
mysqli_close($mysql_connection);
header("Location:transactions.php");
}
}
else
{
$error = "<div class='alert alert-danger alert-dismissable fade in'>
<strong>Ο κωδικός αυτοκινήτου πρέπει να είναι αριθμός<strong>.
</div>";
}
}else
{
$error = "<div class='alert alert-danger alert-dismissable fade in'>
<strong>Το ποσό πληρωμής πρέπει να είναι αριθμός<strong>.
</div>";
}
?>
<body>
<div class="container">
<form method="post" action = "transactionAdd.php">
<?php echo $error;?>
<div class="form-group row">
<label class="col-md-2 control-label">Rent ID</label>
<div class="col-md-5">
<input type="text" class="form-control" name="id" placeholder="Rent ID" value="<?php echo $id;?>" required />
</div>
</div>
<div class="form-group row">
<label class="col-md-2 control-label">Payment Method</label>
<div class="col-md-5">
<input type="text" class="form-control" name="methp" placeholder="Payment Method" value="<?php echo $methp;?>" required />
</div>
</div>
<div class="form-group row">
<label class="col-md-2 control-label">Payment Amount</label>
<div class="col-md-5">
<input type="text" class="form-control" name="amp" placeholder="Payment Amount" value="<?php echo $amp;?>" required />
</div>
</div>
<br></br>
<div class="form-group row">
<div class="col-md-offset-2 col-md-7">
<button type="submit" class="btn btn-success" name="submit">Submit</button>
</div>
</div>
</form>
</body>
</html>