forked from students-alumni-cell-iitkgp/sac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
acapregstu.php
55 lines (42 loc) · 1.28 KB
/
acapregstu.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
<?php
session_start();
require 'connection.php';
$DB_NAME = 'acap';
$connection = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
if ($connection->connect_error) {
// die("Connecton failed: ".$connection->connect_error);
die("It seems that we cannot talk to our DB right now. Please try again in a couple of minutes");
} else {
// echo "Connection Successful<br>";
}
@$name = $_POST["name"];
@$phone = $_POST["phoneno"];
@$email = $_POST["email"];
@$roll = $_POST["roll"];
$pc1 = $_POST["PC1"];
$pc2 = $_POST["PC2"];
$pc3 = $_POST["PC3"];
$pc4=$_POST["PC4"];
//$captcha_s=$_POST["captcha_s"];
//if($_SESSION['captcha_code'] == $captcha_s){
if($name!='' && $phone != "" && $email != "" && $roll != ""&& $pc1 != ""&& $pc2 != "" && $pc3 != ""){
$sql = "INSERT INTO students (name,roll,phone,email,pref1,pref2,pref3,prefcompany)
VALUES ('$name','$roll','$phone','$email','$pc1','$pc2','$pc3','$pc3')";
echo '2';//returning 2 to server if data is added
if ($connection->query($sql)) {
$connection->close();
// header('Location: ./registration-complete.php');
exit;
} else {
echo "Error: " . $connection->error;
}
}
else {
echo '0';//returning 1 to server if data is incomplete
}
//}
/*else
{
echo '0';//returning 0 to server if captcha is wrong
}*/
?>