Skip to content

Commit 72444a8

Browse files
added success page to chk and save in db
1 parent 2310139 commit 72444a8

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

success.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
session_start();
3+
$host="localhost"; // Host name
4+
$username="root"; // Mysql username
5+
$password=""; // Mysql password
6+
$db_name="feedback_db"; // Database name
7+
$tbl_name="feedback"; // Table name
8+
9+
mysql_connect("$host", "$username", "$password")or die("cannot connect to server");
10+
mysql_select_db("$db_name")or die("cannot select DB");
11+
12+
$usn=$_SESSION['usn'];
13+
$topic=$_POST['topic'];
14+
$presenter=$_POST['presenter'];
15+
$q1=$_POST['q1'];
16+
$q2=$_POST['q2'];
17+
$q3=$_POST['q3'];
18+
$q4=$_POST['q4'];
19+
$q5=$_POST['q5'];
20+
$q6=$_POST['q6'];
21+
$q7=$_POST['q7'];
22+
$q8=$_POST['q8'];
23+
$q9=$_POST['q9'];
24+
$q10=$_POST['q10'];
25+
$q11=$_POST['q11'];
26+
$q12=$_POST['q12'];
27+
28+
$avg = (intval($_POST['q1'])+intval($_POST['q2'])+intval($_POST['q3'])+intval($_POST['q4'])+intval($_POST['q5'])+intval($_POST['q6'])+intval($_POST['q7'])+intval($_POST['q8'])+intval($_POST['q9'])+intval($_POST['q10'])+intval($_POST['q11'])+intval($_POST['q12']))/12;
29+
print $avg;
30+
$sql="INSERT INTO $tbl_name VALUES('$usn', '$topic', '$presenter', '$q1', '$q2', '$q3', '$q4', '$q5', '$q6', '$q7', '$q8', '$q9', '$q10', '$q11', '$q12', '$avg')";
31+
$result=mysql_query($sql);
32+
33+
//$sql="INSERT INTO $tbl_name(topic, detail, name, email, datetime)VALUES('$topic', '$detail', '$name', '$email', '$datetime')";
34+
//$result=mysql_query($sql);
35+
36+
mysql_close();
37+
38+
?>
39+
<script>
40+
alert("thank you");
41+
</script>
42+
<?php
43+
header('Location:index.php');
44+
?>

0 commit comments

Comments
 (0)