-
Notifications
You must be signed in to change notification settings - Fork 0
/
db1.php
32 lines (26 loc) · 888 Bytes
/
db1.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
<?php
//Establishing Connection with Server
$connection = mysqli_connect("localhost", "AmanGupta", "adeetiaman1997", "test-a-thon'18");
if(isset($_POST['submit'])){
//Fetching variables of the form which travels in URL
$rollno = $_POST["roll_no"];
$email = $_POST["email"];
$Q1 = $_POST["Q1"];
$Q2 = $_POST["Q2"];
$Q3 = $_POST["Q3"];
$Q4 = $_POST["Q4"];
$Q5 = $_POST["Q5"];
$Q6 = $_POST["Q6"];
$Q7 = $_POST["Q7"];
if($rollno !=''||$email !=''){
//Insert Query of SQL
mysqli_query($connection, "insert into test1(rollno, email, Q1, Q2, Q3, Q4, Q5, Q6, Q7) values ('$rollno', '$email', '$Q1', '$Q2', '$Q3', '$Q4', '$Q5', '$Q6', '$Q7')");
header("refresh:0;url=Thanku.html");
}
else{
echo "<p>Insertion Failed <br/> Some Fields are Blank....!!</p>";
}
}
//Closing Connection with Server
mysqli_close($connection);
?>