-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadduser1.php
107 lines (95 loc) · 1.99 KB
/
adduser1.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
<html>
<head>
<style type="text/css">
h2{
color:green;
text-align: center;
}
.imgcontainer {
text-align: center;
margin: 24px 0 12px 0;
}
img.avatar {
width: 10%;
border-radius: 70%;
}
.container {
padding: 16px;
}
.submit{
background-color: #4CAF50;
width:25%;
margin-left: 450px;
}
</style>
</head>
<body>
<h2>Phone Book</h2>
<div class="imgcontainer">
<img src="/phn.png" alt="Phone " class="avatar" ></div>
<form action="SearchPage_Lab1.php" >
<h2>Congratulations!!! You are now a registered user</h2>
<button style="margin-left:495px;width:15%;height:35px;color:white;background-color:red" class="btn" type="submit" name="home">Return Home</button>
</form>
</body>
</html>
<?php
if(isset($_POST['add'])){
$db = pg_connect("host=localhost port=5432 dbname=phonebook user=postgres password=root");
/*if(!$db){
echo pg_last_error($db);
}else {
echo "hi";
}
*/
$phone=$_POST["phonenumber"];
$name=$_POST["name"];
$mail=$_POST["mail"];
$gender=$_POST["gender"];
$roll=$_POST["roll"];
$dob=$_POST["dob"];
$country=$_POST["country"];
$state=$_POST["state"];
$city=$_POST["city"];
$date=$_POST["date"];
/*
echo "</br>$phone</br></br>";
echo "</br>$name </br >";
echo "</br>$mail</br></br>";
echo "</br>$gender</br></br>";
echo "</br>$roll</br></br>";
echo "</br>$dob</br></br>";
echo "</br>$country</br></br>";
echo "</br>$state</br></br>";
echo "</br>$city</br></br>";*/
$res =pg_query($db,"insert into phonedirectory values($phone,'$name','$mail','$gender',$roll,'$dob','$country','$state','$city','$date')");
if(!$res){
echo pg_last_error($db);
}
else{
echo "";
}
/*
$sql =<<<EOF
SELECT * from book;
EOF;
$ret = pg_query($db, $sql);
if(!$ret){
echo pg_last_error($db);
exit;
}
while($row = pg_fetch_row($ret)){
echo "name = ". $row[0] . "\n";
echo "phonenumber = ". $row[1] ."\n";
}*/
pg_close($db);
}
?>
<html>
<head>
</head>
<body>
<hr>
<p6>This Website is Developed by <a href="https://www.facebook.com/rahulsinghranjann"><b>Rahul Ranjan</b></p6>
</body>
</html>