-
Notifications
You must be signed in to change notification settings - Fork 1
/
form.customer.php
106 lines (103 loc) · 2.72 KB
/
form.customer.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
<script type = "text/javascript" >
function validateCustomer(){
var uid = document.forms["frmCustomer"]["uid"].value;
var name = document.forms["frmCustomer"]["name"].value;
var firm_name = document.forms["frmCustomer"]["firm_name"].value;
var address = document.forms["frmCustomer"]["address"].value;
var phone = document.forms["frmCustomer"]["phone"].value;
var email = document.forms["frmCustomer"]["email"].value;
if(uid == null || uid == ""){
alert("uid can't be empty");
return false;
}
if(name == null || name == ""){
alert("name can't be empty");
return false;
}
if(firm_name == null || firm_name == ""){
alert("firm_name can't be empty");
return false;
}
if(address == null || address == ""){
alert("address can't be empty");
return false;
}
if(phone == null || phone == ""){
alert("phone can't be empty");
return false;
}
if(email == null || email == ""){
alert("email can't be empty");
return false;
}
return true;
}
</script>
<?php
include("header.php");
include("class.customer.dao.php");
?>
<center>
<h3>Add Customer</h3>
<form name = "frmCustomer" method="POST" action="save.customer.php" onsubmit = "return validateCustomer();">
<table cellspacing="5" cellpadding="5">
<?php
if(isset($_GET["id"])){
$dao = new DAOcustomer();
$vo = $dao->get($_GET["id"]);
?>
<tr>
<td> Customer Name </td>
<td><input type = "text" name = "name" value= "<?=$vo->name?> "/></td>
</tr>
<tr>
<td> Firm Name </td>
<td><input type = "text" name = "firm_name" value= "<?=$vo->firm_name?> "/></td>
</tr>
<tr>
<td> Address </td>
<td><input type = "text" name = "address" value= "<?=$vo->address?> "/></td>
</tr>
<tr>
<td> Phone </td>
<td><input type = "text" name = "phone" value= "<?=$vo->phone?> "/></td>
</tr>
<tr>
<td> Email </td>
<td><input type = "text" name = "email" value= "<?=$vo->email?> "/></td>
</tr>
<tr colspan = "2">
<th><input type = "submit" value= "EDIT" /></th>
</tr>
<input type = "hidden" name = "cust_id" value= "<?=$vo->cust_id?> "/>
<?}else{?>
<tr>
<td> Customer Name </td>
<td><input type = "text" name = "name" /></td>
</tr>
<tr>
<td> Firm Name </td>
<td><input type = "text" name = "firm_name" /></td>
</tr>
<tr>
<td> Address </td>
<td><input type = "text" name = "address" /></td>
</tr>
<tr>
<td> Phone </td>
<td><input type = "text" name = "phone" /></td>
</tr>
<tr>
<td> Email </td>
<td><input type = "text" name = "email" /></td>
</tr>
<tr colspan = "2">
<th><input type = "submit" class="btn btn-info" value= "ADD" /></th>
</tr>
<?}?>
</table>
</form>
</center>
<?
include("footer.php");
?>