forked from Subhang23/e-cell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathform.php
44 lines (39 loc) · 1.42 KB
/
form.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
<?php
if(isset($_POST['subData'])){
require('./config.php');
$name=$_POST['Name'];
$college=$_POST['College'];
$email=$_POST['Email'];
$code=$_POST['Code'];
$check ="SELECT * FROM users WHERE webmail='".$email."'";
$confirm=$mysqli->query($check);
echo "hello";
if($confirm->num_rows > 0){
echo "DOne";
}
else{
$sql ="INSERT INTO users (`name`,`college`, `webmail`,`code`) VALUES ('$name', '$college', '$email', '$code')" ;
$res=$mysqli->query($sql);
if(! $res){
echo $mysqli->error;
// echo query($sql);
}
else{
$message="Thank you for showing interest in E-club IIT Patna. For more info please visit our website";
require('./mail.php');
}
}
echo "hi";
}
?>
<form action="" method="post" >
<label for="name">Name</label><br>
<input type="text" name="Name"required><br><br>
<label for="email">Email</label><br>
<input type="email" name="Email" required><br><br>
<label for="college">College</label><br>
<input type="text" name="College"required><br><br>
<label for="code">Referal Code</label><br>
<input type="text" name="Code"><br><br>
<input type="submit" name="subData" value="submit">
</form>