-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode.php
36 lines (32 loc) · 999 Bytes
/
code.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
<?php
session_start();
$con = mysqli_connect("localhost","root","","phptutorials");
if(isset($_POST['submit']))
{
$name = $_POST['name'];
$Surname = $_POST['Surname'];
$PhoneNumber = $_POST['PhoneNumber'];
$dates = $_POST['dates'];
$Age = $_POST['Age'];
$food = $_POST['food'];
$fd="";
$eat = $_POST['Eat'];
$movies = $_POST['Movies'];
$tv = $_POST['TV'];
$radio = $_POST['Radio'];
foreach ($food as $fd1){
$fd.=$fd1.",";
}
$query = "INSERT INTO demo (name,Surname,PhoneNumber,dates,Age,food ,Eat,Movies,TV,Radio) VALUES ('$name','$Surname','$PhoneNumber','$dates','$Age','$fd','$eat','$movies','$tv','$radio')";
$query_run = mysqli_query($con, $query);
if($query_run)
{
$_SESSION['status'] = "Inserted Successfully";
header("Location: index.php");
}
else{
$_SESSION['status'] = "Not Inserted Successfully";
header("Location: Questions.html");
}
}
?>