-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnew_connection.php
153 lines (150 loc) · 4.38 KB
/
new_connection.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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
session_start();
include("dbcon.php");
if(empty($_SESSION['name']) && empty($_SESSION['id']))
{
$_SESSION['error']="Something Went Wrong Please Login First";
header("location:login.php");
}
$id=$_SESSION['id'];
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="files/boot.css">
<!-- Custom CSS -->
<link rel="stylesheet" href="css/style.css">
<title>New Connection</title>
<style>
.container-fluid {
margin:0px;padding:0px;
}
body {
overflow-x :hidden;
}
</style>
</head>
<body>
<div class="container-fluid">
<!-- navbar start -->
<div class="row mt-4">
<div class="col-lg-1 col-md-1 col-sm-1">
</div>
<div class="col-lg-10 col-md-10 col-sm-10 mt-2">
<h1>Welcome <?php echo strtoupper($_SESSION['name']) ?></h1>
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link" href="profile.php">My Profile</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="new_connection.php">New Connection</a>
</li>
<li class="nav-item">
<a class="nav-link" href="bookinghistory.php">Booking History</a>
</li>
</ul>
<?php
if(isset($_SESSION['success']))
{
?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong>Success Message</strong> <?php echo $_SESSION['success'] ?>
<button type="button" class="close" data-dismiss="alert" ><span>×</span></button>
</div>
<?php
unset($_SESSION['success']);
}
?>
<?php
if(isset($_SESSION['error']))
{
?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<strong>Error Message</strong> <?php echo $_SESSION['error'] ?>
<button type="button" class="close" data-dismiss="alert" ><span>×</span></button>
</div>
<?php
unset($_SESSION['error']);
}
?>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<a href="logout.php" class="btn btn-outline-warning float-right mr-4 my-3">logout</a></div>
</div>
</div>
<?php
$sql="select * from registration where id=$id";
$x=mysqli_query($con,$sql);
if($r=mysqli_fetch_assoc($x))
{
?>
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-12 p-4"></div>
<div class="col-lg-4 col-md-4 col-sm-12 p-4">
<form action="" method="post" enctype='multipart/form-data'>
<div class="form-group">
<label for="">Name</label>
<input type="text" name="name" value="<?= $r['name']?>" class="form-control" readonly>
</div>
<div class="form-group">
<label for="">Email</label>
<input type="email" name="email" value="<?= $r['email']?>" class="form-control" readonly>
</div>
<div class="form-group">
<label for="">Mobile</label>
<input type="text" name="mob" value="<?= $r['mob']?>" class="form-control" readonly>
</div>
<div class="form-group">
<label for="">Gas Type</label>
<select name="gastype" id="" class="form-control">
<option value="household">Household</option>
<option value="commercial">commercial</option>
</select>
</div>
<div class="form-group">
<label for="">Address Proof (Aadhar or Registration Proof)</label>
<input type="file" name='proof' class="form-control">
</div>
<div class="form-group text-center">
<button type="submit" class="btn btn-primary" name="id" value="<?= $r['id']?>">SUBMIT</button>
</div>
</form>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 "></div>
</div>
<?php
}
?>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="files/boot.js"></script>
<script src="files/boot1.js"></script>
<script src="files/boot2.js"></script>
</body>
</html>
<?php
include("dbcon.php");
if(isset($_POST['id']))
{
extract($_POST);
$proof_tmp_name=$_FILES['proof']['tmp_name'];
$proof_name=$_FILES['proof']['name'];
move_uploaded_file($proof_tmp_name,"upload/".$proof_name);
$sql="INSERT INTO `connection`(`regid`, `name`, `email`, `mob`, `gastype`, `proof`)
VALUES ($id,'$name','$email','$mob','$gastype','$proof_name')";
if(mysqli_query($con,$sql))
{
$_SESSION['success']="Connection Application Successfully Sent..";
header("location:new_connection.php");
}
else{
$_SESSION['error']="Something went Wrong..";
header("location:new_connection.php");
}
}
?>