-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAddFamilyHistory.php
180 lines (163 loc) · 5.89 KB
/
AddFamilyHistory.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?php require_once('Connections/HMS.php'); ?>
<?php
include 'header.php';
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO familyhistory (patientId, familyRelation, ailmentId, diagnosisDate, symptoms, comments) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['patientId'], "text"),
GetSQLValueString($_POST['familyRelation'], "text"),
GetSQLValueString($_POST['ailmentId'], "text"),
GetSQLValueString($_POST['diagnosisDate'], "text"),
GetSQLValueString($_POST['symptoms'], "text"),
GetSQLValueString($_POST['comments'], "text"));
mysql_select_db($database_HMS, $HMS);
$Result1 = mysql_query($insertSQL, $HMS) or die(mysql_error());
}
mysql_select_db($database_HMS, $HMS);
$query_patient = "SELECT * FROM users";
$patient = mysql_query($query_patient, $HMS) or die(mysql_error());
$row_patient = mysql_fetch_assoc($patient);
$totalRows_patient = mysql_num_rows($patient);
?>
<script src="Calendar/popcalendar.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
function fnOpenCalendar(id1)
{
//alert("Opens the calendar");
var ctl1=document.getElementById(id1);
var ctl2=document.getElementById(id1);
popUpCalendar(ctl1,ctl2,'dd/mm/yyyy');
return true;
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add User</title>
</head>
<body>
<div class="clear"></div>
<!-- start content-outer -->
<div id="content-outer">
<!-- start content -->
<div id="content">
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<div id="page-heading"><h1>Add FamilyHistory</h1></div>
<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
<tr>
<th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
<th class="topleft"></th>
<td id="tbl-border-top"> </td>
<th class="topright"></th>
<th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
</tr>
<tr>
<td id="tbl-border-left"></td>
<td>
<!-- start content-table-inner -->
<div id="content-table-inner">
<!-- starting table contents -->
<table border="0" cellpadding="5" cellspacing="5" id="id-form">
<tr>
<th>PatientId:</th>
<td><select name="patientId" class="styledselect_form_1">
<?php
do {
?>
<option value="<?php echo $row_patient['userId']?>" <?php if (!(strcmp($row_patient['userId'], $row_patient['userId']))) {echo "SELECTED";} ?>><?php echo $row_patient['userName'];?></option>
<?php
} while ($row_patient = mysql_fetch_assoc($patient));
?>
</select>
</td>
</tr>
<tr>
<th>Family Relation:</th>
<td>
<select name="familyRelation" class="styledselect_form_1">
<option value="Father">Father</option>
<option value="Mother">Mother</option>
<option value="Grandfather">Grandfather</option>
<option value="GrandMother">GrandMother</option>
<option value="Brother">Brother</option>
<option value="Sister">Sister</option>
</select>
</td>
</tr>
<tr>
<th>Ailment:</th>
<td><input type="text" name="ailmentId" value="" size="32" class="inp-form"/></td>
</tr>
<tr>
<th>Diagnosis Date:</th>
<td><input id="txtDate1" type="text" name="diagnosisDate" value="" size="32" class="inp-form"/></td>
<td><img alt="" src="Calendar/calender.gif" style="float:right" onClick=" fnOpenCalendar('txtDate1');"/>
</td>
</tr>
<tr>
<th>Symptoms:</th>
<td><input type="text" name="symptoms" value="" size="32" class="inp-form"/></td>
</tr>
<tr>
<th>Comments:</th>
<td><input type="text" name="comments" value="" size="32" class="inp-form"/></td>
</tr>
<tr>
<th> </th>
<td valign="top">
<input type="submit" value="" class="form-submit" />
<input type="reset" value="" class="form-reset" />
</td>
<td></td>
</tr>
</table>
<!-- ending table contents -->
<div class="clear"></div>
</div>
<!-- end content-table-inner -->
</td>
<td id="tbl-border-right"></td>
</tr>
<tr>
<th class="sized bottomleft"></th>
<td id="tbl-border-bottom"> </td>
<th class="sized bottomright"></th>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p> </p>
</body>
</html>