-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdonation.php
More file actions
116 lines (79 loc) · 3.43 KB
/
donation.php
File metadata and controls
116 lines (79 loc) · 3.43 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html>
<html lang="en">
<head>
<title>Contact us</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="donation_style.css">
<link rel="stylesheet" href="alert.css">
</head>
<div class="homeButton"> <a href="http://araniisansthan.com/"> Home </a> </div>
<body>
<?php
$dbusername = "root";
$password = "";
$dbname = "aranii";
$servername = "localhost";
// Create connection
$conn = mysqli_connect($servername, $dbusername, $password , $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
//echo "Connected successfully <br>";
?>
<?php
$name = "";
$email = "";
$phone = "";
$description = "";
$address="";
$date = "";
if(isset($_POST['name'] ) && isset($_POST['email'] ) && isset($_POST['phone'] ) && isset($_POST['description'] ) )
{
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$address=$_POST['address'];
$description = $_POST['description'];
if(!empty($name) && !empty($email) && !empty($phone) && !empty($description) )
{
if(array_key_exists('phone', $_POST) && !preg_match('/^[0-9]{10}$/', $_POST['phone']))
{
$error = '';
$error = 'Invalid Number!';
echo $error;
}
$insert_query = "INSERT INTO donation ( name , phone , email , address ,description ) VALUES ('$name','$phone',
'$email' , '$address', '$description')";
$insert_query_run = mysqli_query($conn , $insert_query);
echo '<div class="alert1"> Your message is successfully sent to Aranii Sansthan We will contact you soon, Thank you ! </div>';
}
}
echo <<< _END
<div class="container">
<div class="col-md-6">
<div id="logbox">
<form id="contact us" method="post" action="donation.php" enctype="multipart/form-data">
<h1>Contact us to make a donation !</h1>
<input name="name" type="text" placeholder="What's your name ?" class="input pass" autofocus="autofocus" value="$name" required ="required"/>
<input name="phone" type="number" placeholder="Phone Number" class="input pass" value = "$phone" required = "required" />
<input name="email" type="email" placeholder="Email address" class="input pass" required = "required" value = "$email"/>
<input name="address" type="text" placeholder="Address *(OPTIONAL)" class="input pass" value = "$address" />
<textarea name = "description" placeholder="Leave a message in 200 characters" class="input pass" value = "$description" required="required" ></textarea> </br>
<input type="submit" value="Submit!" class="inputButton"/>
</form>
</div>
</div>
<!--col-md-6 -->
<div class="col-md-8" style="margin:50px 0px;">
<img src="buy.png" style="width:100%;" />
</div>
</div>
</body>
</html>
_END;
?>