-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
94 lines (90 loc) · 2.58 KB
/
signup.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
<?php include 'inc/header.php';?>
<?php
if($_SERVER['REQUEST_METHOD']=='POST'){
$fname = $fm->validation($_POST['firstname']);
$lname = $fm->validation($_POST['lastname']);
$email = $fm->validation($_POST['email']);
$body = $fm->validation($_POST['body']);
$fname = mysqli_real_escape_string($db->link, $fname);
$lname = mysqli_real_escape_string($db->link, $lname);
$email = mysqli_real_escape_string($db->link, $email);
$body = mysqli_real_escape_string($db->link, $body);
$error = "";
if(empty($fname)){
$error = "First name must not be empty.";
}
elseif(empty($lname)){
$error = "Last name must not be empty.";
}
elseif(empty($email)){
$error = "Email must not be empty.";
}
elseif(!filter_var($email, FILTER_VALIDATE_EMAIL)){
$error = "Invalid Email Address!";
}
elseif(empty($body)){
$error = "Message field must not be empty.";
}
else{
$query = "INSERT INTO contact(firstname, lastname, email, body) VALUES('$fname', '$lname', '$email', '$body')";
$inserted_rows = $db->insert($query);
if ($inserted_rows) {
$msg = "Message send successfully.";
}
else {
$error = "Unfortunately, message is not send.";
}
}
}
?>
<div class="contentsection contemplete clear">
<div class="maincontent clear">
<div class="about">
<h2>Contact us to be an agri-blogger.</h2>
<?php
if(isset($error)){
echo "<span style='color:red; font-weight:bold;'>$error</span>";
}
if(isset($msg)){
echo "<span style='color:green; font-weight:bold;'>$msg</span>";
}
?>
<form action="" method="post">
<h3>We provide author and editor profiles only. If you want to be an agri-blogger or editor then send your details by filling up the form below. We will notify you ASAP.</h3></br></br>
<table>
<tr>
<td>First Name:</td>
<td>
<input type="text" name="firstname" placeholder="Enter your first name"/>
</td>
</tr>
<tr>
<td>Last Name:</td>
<td>
<input type="text" name="lastname" placeholder="Enter your last name"/>
</td>
</tr>
<tr>
<td>Email Address:</td>
<td>
<input type="text" name="email" placeholder="Enter your email address"/>
</td>
</tr>
<tr>
<td>About Yourself:</td>
<td>
<textarea name="body"></textarea>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" name="submit" value="Send"/>
</td>
</tr>
</table>
<form>
</div>
</div>
<?php include "inc/sidebar.php";?>
<?php include "inc/footer.php";?>