-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathneha_form3.php
88 lines (56 loc) · 1.44 KB
/
neha_form3.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
<?php
$servername="localhost";
$username="root";
$password="";
$Dbname="neha";
//create connection
$conn=mysqli_connect($servername,$username,$password,$Dbname);
if((isset($_POST['submit']))){
$name=$_POST['yname'];
$passwrd=md5($_POST['pass']);
$mail=$_POST['email'];
$sql="INSERT INTO login(name, password,email,created,modified) VALUES ('".$name."', '".$passwrd."', '".$mail."',now(), now())";
if ($conn->query($sql)===TRUE) {
echo "New record created successfully";
} else {
echo "error:" .$sql. "<br>". $conn->error;
}
}
else {
echo "Please enter valid filed";
}
?>
<!DOCTYPE html>
<html>
<head>
<title>registration form</title>
</head>
<body>
<center>
<form action="" method="post">
Name: <input type="text" name="yname"><br>
Password: <input type="password" name="pass"><br>
Email: <input type="text" name="email"><br>
<input type="submit" name="submit">
</form>
</center>
<div align="center">
<table border="2" width="600">
<tr>
<td>ID</td>
<td>Name</td>
<td>Password</td>
<td>Email</td>
</tr>
<?php $query = "select * from login ORDER BY `name` DESC";
$runQuery= $conn->query($query);
while($row = $runQuery->fetch_assoc()) { ?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['password']; ?></td>
<td><?php echo $row['email']; ?></td>
</tr>
<?php } ?>
</table>
</div>