forked from drever/web-vpi
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathanswer.php
155 lines (140 loc) · 4.12 KB
/
answer.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<html>
<head>
<meta charset="utf-8"/>
<title>Report</title>
<link href='http://fonts.googleapis.com/css?family=Metrophobic' rel='stylesheet' type='text/css'>
<link href="css/vpi.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
if(isset($_POST['Answer']))
{
require 'db.php'
mysql_select_db('morphome-vpi');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not enter data: ' . mysql_error());
}
echo "<html>";
echo "<head>";
echo " <meta charset=\"utf-8\"/>";
echo " <title>Report</title>";
echo " <link href='http://fonts.googleapis.com/css?family=Metrophobic' rel='stylesheet' type='text/css'>";
echo " <link href=\"css/vpi.css\" rel=\"stylesheet\" type=\"text/css\">";
echo "</head>";
echo "<body>";
echo "<div style=\"height:310px;width:280px;\">";
echo "Thanks for your participation!\n";
echo "<br>\n";
echo "<br>\n";
echo "Since we want to collect as much data as possible, it would be great to try to do as much trials as you can.\n";
echo "Each interaction engages a partner with a totally different behavior.\n";
echo "<br>\n";
echo "<br>\n";
echo "You can also share this experiment with all your friends... ;)\n";
echo "<br>\n";
echo "</div>\n";
echo "<div style=\"height:6px;width:280px;\">";
echo "<a href=\"trial.php\">Replay</a> or <a href=\"index.php\">Back to Main Page.</a>\n";
echo "</div>";
mysql_close($conn);
}
else
{
?>
<div style="height:480px;width:280px;">
<h1> Report </h1>
<form id="radio-form" onsubmit="return validate();" method="post" action="<?php $_PHP_SELF ?>">
<table width="400" border="0" cellspacing="1" cellpadding="2">
<tr>
<td width="400">How cooperative was the partner?</td>
</tr>
<tr>
<td>
<input type="radio" name="cooperativeness" value="-1" style="margin-left: 50px">Very competitive
<br><input type="radio" name="cooperativeness" value="-0.5" style="margin-left: 50px">Competitive
<br><input type="radio" name="cooperativeness" value="0" style="margin-left: 50px">Neutral
<br><input type="radio" name="cooperativeness" value="0.5" style="margin-left: 50px">Cooperative
<br><input type="radio" name="cooperativeness" value="1" style="margin-left: 50px">Very Cooperative
</td>
</tr>
<td>
<tr></tr>
</td>
<tr>
<td width="400">How human-like was the partner?<br></td>
</tr>
<tr>
<td>
<input type="radio" name="humanness" value="-1" style="margin-left: 50px">Robot like
<br><input type="radio" name="humanness" value="-0.5" style="margin-left: 50px">Slightly robot like
<br><input type="radio" name="humanness" value="0" style="margin-left: 50px">I don't know...
<br><input type="radio" name="humanness" value="0.5" style="margin-left: 50px">Slightly human like
<br><input type="radio" name="humanness" value="1" style="margin-left: 50px">Human like
</td>
</tr>
<tr>
<td width="400">What controler did you use?<br></td>
</tr>
<tr>
<td>
<input type="radio" name="controler" value="1" style="margin-left: 50px">Mouse
<br><input type="radio" name="controler" value="0" style="margin-left: 50px">Trackpad
<br><input type="radio" name="controler" value="-1" style="margin-left: 50px">Other
</td>
</tr>
<tr>
<td width="300">
<input name="Answer" type="submit" id="Answer" value="Answer" style="margin-left: 200px">
</td>
</tr>
</table>
</form>
<?php
}
?>
</div>
<script>
function validate() {
// check cooperativeness input
var r = document.getElementsByName("cooperativeness");
var c = -1;
for(var i=0; i < r.length; i++){
if(r[i].checked) {
c = i;
}
}
if (c == -1) {
alert("Please select cooperativeness.");
return false;
}
// check humanness input
var r = document.getElementsByName("humanness");
var c = -1;
for(var i=0; i < r.length; i++){
if(r[i].checked) {
c = i;
}
}
if (c == -1) {
alert("Please select humaness.");
return false;
}
// check controler input
var r = document.getElementsByName("controler");
var c = -1;
for(var i=0; i < r.length; i++){
if(r[i].checked) {
c = i;
}
}
if (c == -1) {
alert("Please select controler.");
return false;
}
return true;
}
</script>
</body>
</html>