-
Notifications
You must be signed in to change notification settings - Fork 0
/
write.php
50 lines (45 loc) · 1.79 KB
/
write.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
49
50
<?php
session_start();
if (isset($_POST["Ebtn"]))
{
header("Location: addpatient.php");
}
else if (isset($_POST["Sbtn"]))
{
/*Writing to file*/
$Patientfile = fopen("patientdata.txt", "w") or die("Unable to open file!");
fwrite($Patientfile, "Name: ");
fwrite($Patientfile, $_SESSION['title']);
fwrite($Patientfile, " ");
fwrite($Patientfile, $_SESSION['fname']);
fwrite($Patientfile, " ");
fwrite($Patientfile, $_SESSION['lname']);
fwrite($Patientfile, "\n");
fwrite($Patientfile, "Date of Birth: ");
fwrite($Patientfile, $_SESSION['dob']);
fwrite($Patientfile, "\n");
fwrite($Patientfile, "TRN: ");
fwrite($Patientfile, $_SESSION['trn']);
fwrite($Patientfile, "\n");
fwrite($Patientfile, "Address: ");
fwrite($Patientfile, $_SESSION['street']);
fwrite($Patientfile, ", ");
fwrite($Patientfile, $_SESSION['district']);
fwrite($Patientfile, "\n ");
fwrite($Patientfile, $_SESSION['city']);
fwrite($Patientfile, " ");
fwrite($Patientfile, $_SESSION['country']);
fwrite($Patientfile, "\n");
fwrite($Patientfile, "Email address: ");
fwrite($Patientfile, $_SESSION['email']);
fwrite($Patientfile, "\n");
fwrite($Patientfile, "Telephone number: ");
fwrite($Patientfile, $_SESSION['phone']);
fwrite($Patientfile, "\n");
fwrite($Patientfile, "------------------------------------------------------------------------------------------");
fwrite($Patientfile, "\n\n");
fclose($Patientfile);
session_unset();
header("Location: login.php");
}
?>