-
Notifications
You must be signed in to change notification settings - Fork 0
/
memberinfo_.php
48 lines (37 loc) · 1.56 KB
/
memberinfo_.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
37
38
39
40
41
42
43
44
45
46
47
48
<?php
$member_id = $_POST['member_id'];
$member_name = $_POST['member_name'];
$member_DOB = $_POST['member_DOB'];
if ($_POST['member_gender'] == "male") $member_gender = 'm';
else $member_gender = 'f';
$member_address = $_POST['member_address'];
$member_street = $_POST['member_street'];
$member_city = $_POST['member_city'];
$member_state = $_POST['member_state'];
$member_zip = $_POST['member_zip'];
$member_phone = $_POST['member_phone'];
$member_email = $_POST['member_email'];
$member_country = $_POST['member_country'];
?>
<?php
if ($member_id > 0) { //update or delete
include "memberinfoupdate_.php";
} else { // add a new member
$query = "insert into address (street, city, state, zip, country) values ";
$query = $query."('$member_address', '$member_city', '$member_state', '$member_zip', '$member_country')";
//echo $query."<br>";
$result = $conn->query($query);
$query = "select max(id) as max_id from address";
$result = mysqli_query($conn, $query);
//print_r($result);
$row = mysqli_fetch_row($result);
$max_id = $row[0];
//print_r($row);
//echo "<br> address added, ID: ".$max_id;
$query="insert into patient (name, DOB, gender, address_id, phone, email) values ";
$query=$query."('$member_name', '$member_DOB', '$member_gender', $max_id, '$member_phone', '$member_email')";
//echo "insert query: ".$query;
$result = $conn->query($query);
echo "<br> Member added. ";
}
?>