-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactionpage.php
More file actions
67 lines (46 loc) · 1.42 KB
/
actionpage.php
File metadata and controls
67 lines (46 loc) · 1.42 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
<html>
<head>
<meta http-equiv = "refresh" content = "10;url= front.php"/>
</head><body>
<?php
$name = $cno=$p_error=$name_error=$time_error=$rid_error="";
$server = "localhost";
$user = "root";
$pass = "";
$db = "db_new";
$connect = mysqli_connect($server,$user,$pass,$db);
if(!$connect)
die("error". mysqli_connect_error());
if($_SERVER["REQUEST_METHOD"] == "POST"){
if(empty($_POST["name"]))
$name_error = "Enter the Name Propery !";
else{
$name = $_POST["name"];
}
if(empty($_POST["cno"]) && strlen($_POST["cno"] != 10) )
$cno_error = "Enter Valid Contact number";
else{
$cno = $_POST["cno"];
}
if(empty($_POST["purpose"]))
$p_error = "Enter Valid Purpose";
else
$p = $_POST["purpose"];
$timein = $_POST["timein"];
$rid = $_POST["id"];
$date = $_POST["date"];
$day = date("d");
$month = date("m");
$year = date("Y");
if(empty($name) || empty($cno) || empty($p) || strlen($cno)!=10)
{
echo "<br><br><h4>You have not entered the details correctly !!</h4>";
}
else{
$sql = "INSERT INTO info_visitor(Name, Contact, Purpose, day, month, year, Date, TimeIN, ReceiptID,Status) VALUES ('$name','$cno','$p','$day', '$month', '$year','$date','$timein','$rid','ONLINE' )";
if(mysqli_query($connect,$sql)) echo "<br><br><h3>Your Data has been saved to the database !!<h3/>";
else echo "Error: " . $sql . "<br>" . mysqli_error($connect);}
echo "<h4>You will be redirected to the home page after 10 secs !</h4> ";
}?>
</body>
</html>