This repository has been archived by the owner on Dec 21, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
contact.php
105 lines (90 loc) · 3.35 KB
/
contact.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
<script type="text/javascript">
$(document).ready(function(){
$('.error').hide();
$('#loader').hide();
$('form').submit(function(event) {
$('#loader').show();
$('input[type=submit]', this).attr('disabled', 'disabled');
$('input[type=submit]', this).attr('value', 'Sending...');
var errors = false;
//If either the name
if ( $('#name').val() === null || $('#name').val() === '' ) {
$('#name-error').slideDown('slow');
$('input[type=submit]', this).attr('disabled', '');
$('input[type=submit]', this).attr('value', 'Send');
errors = true;
$('#loader').hide();
event.preventDefault();
}
//or the email are blank, show the error
if ( ($('#email').val() === '') && $('#telephone').val() === '' ) {
$('.te-error').slideDown('slow');
$('input[type=submit]', this).attr('disabled', '');
$('input[type=submit]', this).attr('value', 'Send');
errors = true;
$('#loader').hide();
event.preventDefault();
}
if ( !errors ){
var data = 'Name='+$('#name').val()+'&Company='+$('#company').val()+'&Telephone='+$('#telephone').val();
data += '&Email='+$('#email').val()+'&franchise='+$('.franchise:checked').val()+'&new='+$('.new:checked').val();
data += '&comments='+$('#comments').val();
$.ajax({
type: "GET",
url: "/assets/contact_process.php",
data: data,
success: function(msg){
$('input[type=submit]').attr('value', 'SENT!');
$('#loader').hide();
}
});
event.preventDefault();
}
});
$('#name').keyup(function(){
$('#name-error').slideUp('slow');
});
$('#telephone').keyup(function(){
$('.te-error').slideUp('slow');
});
$('#email').keyup(function(){
$('.te-error').slideUp('slow');
});
});
</script>
<form name="jkcontact" method="post" action="/assets/contact_process.php" style="width:500px;" class="left">
<fieldset>
<legend>Contact Us</legend>
<p>
<div class="error" id="name-error">Please enter your name.</div>
<label for="name">Name:</label><br />
<input type="text" name="Name" id="name" class="title" />
</p>
<p>
<label for="company">Company:</label><br />
<input type="text" name="Company" id="company" class="text" />
</p>
<p>
<div class="error te-error">Please enter your telephone number or an email address.</div>
<label for="email">Email:</label><br />
<input type="text" name="Email" id="email" class="text" />
</p>
<p>
<div class="error te-error">Please enter your telephone number or an email address.</div>
<label for="telephone">Telephone:</label><br />
<input type="text" name="Telephone" id="telephone" class="text" />
</p>
<p>
<label>What would you like to contact us about?</label><br />
<input type="checkbox" class="franchise" name="franchise" value="true" />I would like information about owning a franchise.<br />
<input type="checkbox" class="new" name="new" value="true" />I am a business owner that would like information about your services.<br />
</p>
<p>
<label for="comments">Do you have any additional comments?</label><br />
<textarea name="comments" id="comments"></textarea>
</p>
<p>
<input name="Send" type="submit" id="send" value="Send" /><img src="/images/ajax-loader.gif" alt="Sending..." id="loader"/>
</p>
</fieldset>
</form>