-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAddPerson.php
190 lines (174 loc) · 6.59 KB
/
AddPerson.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
181
182
183
184
185
186
187
188
189
190
<?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 person (fName, mName, lName, address, rPhone, mobile, registrationNo, gender, DOB, email) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['fName'], "text"),
GetSQLValueString($_POST['mName'], "text"),
GetSQLValueString($_POST['lName'], "text"),
GetSQLValueString($_POST['address'], "text"),
GetSQLValueString($_POST['rPhone'], "text"),
GetSQLValueString($_POST['mobile'], "text"),
GetSQLValueString($_POST['registrationNo'], "text"),
GetSQLValueString($_POST['gender'], "text"),
GetSQLValueString($_POST['DOB'], "text"),
GetSQLValueString($_POST['email'], "text"));
mysql_select_db($database_HMS, $HMS);
$Result1 = mysql_query($insertSQL, $HMS) or die(mysql_error());
}
?>
<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 Person</title>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</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 Person</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>First Name:</th>
<td>
<input type="text" name="fName" size="32" class="inp-form-error"/>
</td>
</tr>
<tr>
<th>Middle Name:</th>
<td><input type="text" name="mName" value="" size="32" class="inp-form"/></td>
</tr>
<tr>
<th>Last Name:</th>
<td><input type="text" name="lName" value="" size="32" class="inp-form"/></td>
</tr>
<tr>
<th>Address:</th>
<td><textarea rows="3" name="address" size="32" class="inp-form"> </textarea></td>
</tr>
<tr>
<th>Residece Phone:</th>
<td><input type="text" name="rPhone" value="" size="32" class="inp-form"/></td>
</tr>
<tr>
<th>Mobile:</th>
<td><input type="text" name="mobile" value="" size="32" class="inp-form"/></td>
</tr>
<tr>
<th valign="top">Registration No:</th>
<td><input type="text" name="registrationNo" value="" size="32" class="inp-form"/></td>
</tr>
<tr>
<th>Gender:</th>
<td><select name="gender" class="styledselect_form_1">
<option value="Male" <?php if (!(strcmp("Male", ""))) {echo "SELECTED";} ?>>Male</option>
<option value="Female" <?php if (!(strcmp("Female", ""))) {echo "SELECTED";} ?>>Female</option>
</select></td>
</tr>
<tr>
<th>Date Of Birth:</th>
<td><input id="txtDate1" type="text" name="DOB" value="" size="32" class="inp-form" />
</td>
<td><img alt="" src="Calendar/calender.gif" style="float:right" onClick=" fnOpenCalendar('txtDate1');"/>
</td>
</tr>
<tr>
<th>Email:</th>
<td>
<input type="text" name="email" 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>
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur", "change"], minChars:2});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "email", {validateOn:["blur", "change"]});
</script>
</body>
</html>