-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuploadanswer.php
More file actions
25 lines (20 loc) · 1 KB
/
uploadanswer.php
File metadata and controls
25 lines (20 loc) · 1 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
<?php
$hostname = "localhost";
$username = "root";
$dbname = "survey" ;
$password = "";
$con=mysqli_connect($hostname,$username,$password,$dbname);
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$money = mysqli_real_escape_string($con, $_POST['money']);
$income = mysqli_real_escape_string($con, $_POST['income']);
$habit = mysqli_real_escape_string($con, $_POST['habit']);
$donationUse = mysqli_real_escape_string($con, $_POST['donationUse']);
$education = mysqli_real_escape_string($con, $_POST['education']);
// INSERT INTO `answer`(`donation`, `income`, `habit`, `reason`, `education`) VALUES ('[value-1]','[value-2]','[value-3]','[value-4]','[value-5]')
$sql="INSERT INTO `answer`(`donation`, `income`, `habit`, `reason`, `education`) VALUES ('$money','$income', '$habit', '$donationUse','$education')";
if (!mysqli_query($con,$sql)) {
die('Error: ' . mysqli_error($con));
}
?>