-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendSurvey.php
More file actions
74 lines (72 loc) · 2.55 KB
/
Copy pathsendSurvey.php
File metadata and controls
74 lines (72 loc) · 2.55 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
68
69
70
71
72
73
74
<!DOCTYPE html>
<html lang="en">
<head>
<title>sendSurvey</title>
<meta charset="UTF-8">
</head>
<body>
<?php
require_once "connect.php";
$con=@new mysqli($host,$db_user,$db_password,$db_name);
if($con->connect_errno!=0){
echo "Error".$con->connect_errno;//." Description ".$con->connect_error;
}else{
$userName=$_POST['name'];
if(!isset($_POST['isClickerGood']))
{
$isClickerGood =false;
} else {
$isClickerGood = true;
}
if(!isset($_POST['isTicTacToeGood']))
{
$isTicTacToeGood = false;
} else {
$isTicTacToeGood = true;
}
if(!isset($_POST['isRockPaperScissorsGood']))
{
$isRockPaperScissorsGood = false;
} else {
$isRockPaperScissorsGood = true;
}
if(!isset($_POST['isSurveyGood']))
{
$isSurveyGood = false;
} else {
$isSurveyGood = true;
}
$remarkText=$_POST['remarkArea'];
echo "<h2 style='color:red'>Thank you for using this project $userName</h2>";
if($isClickerGood){
echo "<h4>You like Clicker</h4>";
}else{
echo "<h4 style='color:brown;'>You don't like Clicker</h4>";
}
if($isTicTacToeGood){
echo "<h4>You like Tic Tac Toe</h4>";
}else{
echo "<h4 style='color:brown;'>You don't like Tic Tac Toe</h4>";
}
if($isRockPaperScissorsGood){
echo "<h4>You like Rock Paper Scissors</h4>";
}else{
echo "<h4 style='color:brown;'>You don't like Rock Paper Scissors</h4>";
}
if($isSurveyGood){
echo "<h4>You like the survey :-)</h4>";
}else{
echo "<h4 style='color:brown;'>You don't like the survey :-(</h4>";
}
echo "<h4><i>You send following remark:</i></h4>";
echo $remarkText;
if($con->query("INSERT INTO answers VALUES('$userName','$isClickerGood','$isTicTacToeGood','$isRockPaperScissorsGood','$isSurveyGood','$remarkText',NULL)")){
echo "<h4 style='color:green;'>Data added to database</h4>";
}else{
throw new Exception($con->error);
}
$con->close();
}
?>
</body>
</html>