-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpetownerinfo_edit.php
123 lines (108 loc) · 4.37 KB
/
petownerinfo_edit.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
<!doctype html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Staff Information</title>
<meta name="viewport" content="width=device-width" />
<link href="http://fonts.googleapis.com/css?family=Dosis:200,300,400,500,600,700,800" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/petownerinfo_edit.css" />
</head>
<body>
<div class="container">
<!--SIDEBAR-->
<aside id="sidebar">
<!--logo-->
<a href="#" class="logo"><img src="pic/logo2.png" alt="logo" /></a>
<!--main-menu-->
<nav class="main-nav">
<ul>
<li><a href="homepage.html">Homepage</a></li>
<li><a href="clinicinfohomepage.php">Clinic Info</a></li>
<li><a href="petview.php?page=1">Pet Info</a></li>
<li class="active"><a href="petowner.php">Petowner Info</a></li>
<li><a href="appointmentinfo.html">Appointment Info</a></li>
<li><a href="treatmentinfo.php?page=1">Treatment Info</a></li>
<li><a href="treatmentrecord.php">Treatment Record</a></li>
<li><a href="staffinfo.php">Staff Info</a></li>
</ul>
</nav>
</aside>
<!--CONTENT-->
<section id="content">
<!--header-->
<header>
<h1>Staff Information</h1>
</header>
<!--main-->
<div class="page">
<div class="staffinfo">
<?php
error_reporting(0);
$con = mysql_connect('localhost', 'root');
//these are the aforementioned vars
$db = mysql_select_db('399lovelypets');
//if($con){
//echo 'Successfully connected to the database';
//}
//else{
// die('Error.');
//}
if(isset($_POST['update'])){
$UpdateQuery = "UPDATE petowner SET PetOwnerID = '$_POST[dosubmit]', PetOwnerName = '$_POST[name]', PetOwnerPhoneNumber = '$_POST[num]', PetOwnerEmailAddress = '$_POST[email]', PetOwnerHomeAddress = '$_POST[address]' WHERE petowner.PetOwnerID = '$_POST[hidden]'";
mysql_query($UpdateQuery, $con);
SUBMISSION();
};
if(isset($_POST['delete'])){
$DeleteQuery = "DELETE FROM petowner WHERE PetOwnerID = '$_POST[hidden]'";
mysql_query($DeleteQuery, $con);
SUBMISSION();
}
function SUBMISSION(){
echo"<script type=\"text/javascript\">document.location.href='./petowner.php';</script>";
$CON->CLOSE();
}
?>
<div class="editpage">
<h2>PetOwner Information Edit</h2>
<?php
$query = mysql_query("SELECT * FROM petowner WHERE PetOwnerID = '$_POST[dosubmit]'");
while($row = mysql_fetch_array($query)){
$id = $row['PetOwnerID'];
$name = $row['PetOwnerName'];
$address = $row['PetOwnerHomeAddress'];
$num = $row['PetOwnerPhoneNumber'];
$email = $row['PetOwnerEmailAddress'];
echo '<hr>';
echo '<table class="staffinfo1">';
echo '<form action="petownerinfo_edit.php" method="post">';
echo '<tr>';
echo '<td style="width:100px">ID Number:</td><td><input style="width:100px" class=round type=text name=dosubmit value=' . $id . ' </td>';
echo '<td style="width:60px">Name:</td><td><input style="width:120px" class=round type=text name=name value="' . $name . '" </td>';
echo '<td><input type=submit name=update value=Update /></td>';
echo '</tr>';
echo '<tr>';
echo '<td noWrap>Mobile:</td><td><input style="width:100px" type=text name=num class=round value=' . $num . ' </td>';
echo '<td>E-mail:</td><td><input style="width:120px" type=text name=email class=round value=' . $email . ' </td>';
echo '<td><input type=submit name=delete value=Delete /></td>';
echo '</tr>';
echo '<tr>';
echo '<td> Address:</td><td colspan="4"><input style="width:315px" type=text name=address class=round value="' . $address . '" </td>';
echo '</tr>';
echo '<tr>';
echo '<td><input style="width:0px" type=hidden name=hidden value=' . $id . ' </td>';
echo '</tr>';
echo '<tr>';
echo '</tr>';
echo '</form>';
echo '</table>';
echo '<hr>';
}
mysql_close($con);
?>
</div>
</div>
</section>
</div>
</body>
</html>