-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsaving_data.php
More file actions
30 lines (27 loc) · 1.13 KB
/
Copy pathsaving_data.php
File metadata and controls
30 lines (27 loc) · 1.13 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
26
27
28
29
30
<?php session_start();
if (isset($_GET['table'])) {
$table = $_GET['table'];
if ($table ==="general_info") {
$_SESSION['general_info']["name"] = $_GET["name"];
$_SESSION['general_info']["email"] = $_GET["email"];
$_SESSION['general_info']["password"] = $_GET["password"];
print_r($_SESSION['general_info']);
}
if ($table ==="contact_info") {
$name = $_SESSION['general_info']["name"];
$email = $_SESSION['general_info']["email"];
$password = $_SESSION['general_info']["password"];
$address1 = $_GET['address1'];
$address2 = $_GET['address2'];
$country = $_GET['country'];
$phone = $_GET['phone'];
$db = new mysqli('localhost', 'root', '', 'skill_test') or die('db not connected');
$sql = "insert into general_info(name,email,password)values('$name','$email','$password')";
$db->query($sql) or die("general_info table data not saved");
unset($_SESSION['general_info']);
$sql1 = "insert into contact_info(address_one,address_two,country,phone)values('$address1','$address2','$country','$phone')";
$db->query($sql1) or die("contact_info table data not saved");
echo "success";
}
}
?>