-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmedicinevend.php
More file actions
183 lines (176 loc) · 7.05 KB
/
medicinevend.php
File metadata and controls
183 lines (176 loc) · 7.05 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
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
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Medicine Details </title>
</head>
<body style="background-color:skyblue">
<hr />
<center> <h2> Medicine Buy From Vendor Details </h2> </center>
<hr />
<center>
<form #action="details.php" method = "post">
<br />
<table>
<tr>
<td><br />Vendor ID.       </td>
<td><br /><input type="name" name="vid" /><font color="RED" SIZE="2">*</font>            </td>
</tr>
<tr>
<td><br />Name       </td>
<td><br /><input type="name" name="vname" /><font color="RED" SIZE="2">*</font>            </td>
</tr>
<tr>
<td><br />Area       </td>
<td><br /><input type="name" name="area" /><font color="RED" SIZE="2">*</font>            </td>
</tr>
<tr>
<td><br />Sex       </td>
<td><br /><input type="name" name="sex" /><font color="RED" SIZE="2">*</font>            </td>
</tr>
<tr>
<td><br />Date       </td>
<td><br /><input type="name" name="date" /><font color="RED" SIZE="2">*</font>            </td>
</tr>
<tr>
<td><br />Store ID       </td>
<td><br /><input type="name" name="sid" /><font color="RED" SIZE="2">*</font>            </td>
</tr>
<tr>
<td><br />Medicine Batch No.       </td>
<td><br /><input type="name" name="batchno" /><font color="RED" SIZE="2">*</font>            </td>
</tr>
<tr>
<td><br />Medicine Name       </td>
<td><br /><input type="name" name="name" /><font color="RED" SIZE="2">*</font>            </td>
</tr>
<tr>
<td><br />Price       </td>
<td><br /><input type="name" name="price" /><font color="RED" SIZE="2">*</font>            </td>
</tr>
<tr>
<tr>
<td><br />Quantity       </td>
<td><br /><input type="name" name="qty" /><font color="RED" SIZE="2">*</font>            </td>
</tr>
<td><br /> Expiry Date       </td>
<td><br /><input type="name" name="exirydate" /><font color="RED" SIZE="2">*(yyyy-mm-dd)</font>            </td>
</tr>
<tr>
<td> <br /> Category       </td>
<td><br /><select name="category" multiple>
<option value="Anti-inflammatory">Anti-inflammatory</option><
<option value="Analgesic">Analgesic</option>
<option value="Antipyretic">Antipyretic</option>
<option value="Antitussive">Antitussive</option>
<option value="Antiviral">Antiviral</option>
<option value="Antifungal">Antifungal</option>
<option value="Antibiotic">Antibiotic</option>
<option value="Anaesthetic">Anaesthetic</option>
<option value="Surfactant">Surfactant</option>
<option value="Laxative">Laxative</option>
<option value="Antihypertensive">Antihypertensive</option>
<option value="Vaccine">Vaccine</option>
<option value="Vitamin supplement">Vitamin supplement</option>
<option value="Antacids">Antacids</option>
<option value="Antidotes">Antidotes</option>
<option value="Antipsychotics">Antipsychotics</option>
<option value="Antimetabolites">Antimetabolites</option>
<option value="Catecholamines">Catecholamines</option>
<option value="Antihistamines">Antihistamines</option>
<option value="Other">Other</option>
</select><font color="RED" SIZE="2">*</font></td>
</tr>
<tr>
<td><br /> If Other       </td>
<td><br /><input type="name" name="othr">             </td>
</tr>
<tr>
</table>
<br /><br /><input type ="submit" value="Submit">
</center>
</form>
<?php
$con = mysql_connect("localhost","root","");
if(!$con)
{
die("Connection Failed");
}
if(!(mysql_select_db("medical_inventory", $con)))
{
die ("Database Not Selected");
}
$x=0;
if ( isset ($_POST['sid']))
{
$query = "SELECT * from store where SID=".$_POST['sid'].";";
$sql = mysql_query($query,$con);
$row=mysql_fetch_array($sql);
if (!empty($row))
{
if (isset($_POST['batchno']) && isset($_POST['name']) && isset($_POST['price']) && isset($_POST['exirydate']))
$query = "INSERT INTO medicines (Batchno,Name,Price,ExpiryDate) VALUES ('$_POST[batchno]','$_POST[name]','$_POST[price]','$_POST[exirydate]')";
if (isset ($query))
$sql = mysql_query($query,$con);
if (isset ($sql))
if (!$sql)
{
echo "<br /> <font size='2' color='red'>*Required Fields are Mandotary</font>";
}
if (isset($_POST['batchno']) && isset($_POST['name']) && isset($_POST['sid']) && isset($_POST['qty']))
$query = "INSERT INTO contains (SSID,Medbatchno,Medname,Qty) VALUES ('$_POST[sid]','$_POST[batchno]','$_POST[name]','$_POST[qty]')";
if (isset ($query))
$sql = mysql_query($query,$con);
if (isset($_POST['vid']) && isset($_POST['vname']) && isset($_POST['area']) && isset($_POST['sex']))
$query = "INSERT INTO vendors (ID,Name,Area,Sex) VALUES ('$_POST[vid]','$_POST[vname]','$_POST[area]','$_POST[sex]')";
if (isset ($query))
$sql = mysql_query($query,$con);
if (isset ($sql))
if (!$sql)
{
echo "<br /> <font size='2' color='red'>*Required Fields are Mandotary</font>";
}
if (isset($_POST['batchno']) && isset($_POST['name']) && isset($_POST['category']))
{
if($_POST['category'] == "Other")
$query = "INSERT INTO medicinecategory(Batchno,Name,Category) VALUES ('$_POST[batchno]','$_POST[name]','$_POST[othr]')";
else
$query = "INSERT INTO medicinecategory(Batchno,Name,Category) VALUES ('$_POST[batchno]','$_POST[name]','$_POST[category]')";
}
if (isset ($query))
$sql = mysql_query($query,$con);
if (isset ($sql))
if (!$sql)
{
echo "<br /> <font size='2' color='red'>*Required Fields are Mandotary</font>";
}
else
header ("Location:option.php");
if (isset($_POST['vid']) && isset($_POST['name']) && isset($_POST['batchno']) )
$query = "INSERT INTO te(ID,Medname,MedBatchno) VALUES ( '".$_POST['vid']."','".$_POST['name']."','".$_POST['batchno']."')";
if (isset ($query))
$sql = mysql_query($query,$con);
if (isset ($sql))
if (!$sql)
{
echo "<br /> <font size='2' color='red'>*Required Fields are Mandotary</font>";
}
if (isset($_POST['vid']) && isset($_POST['name']) && isset($_POST['batchno']) && isset($_POST['qty']) && isset($_POST['sid']) && isset($_POST['date']) )
$query = "INSERT INTO supplied(XID,Medname,MedBatchno,Qty,SSID,Date) VALUES( '".$_POST['vid']."','".$_POST['name']."','".$_POST['batchno']."','".$_POST['qty']."','".$_POST['sid']."','".$_POST['date']."')";
if (isset ($query))
$sql = mysql_query($query,$con);
if (isset ($sql))
if (!$sql)
{
echo "<br /> <font size='2' color='red'>*Required Fields are Mandotary</font>";
}
//unset($_POST['sid']);
}
else
{
echo"<script>alert('Store does not exist!');</script>";
}
}
?>
</body>
</html>