index.php
Gesponsorde koppelingen
PHP script bestanden
Code (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
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
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
$('#submit').click(function() {
var postc = $('#postc').val();
var huisnr = $('#huisnr').val();
if(!postc || !huisnr) {
alert("Je moet wel een postcode EN huisnr invullen.");
}
else {
$.ajax({
url: 'postcodeCheck.php',
type: 'GET',
dataType: 'json',
data: 'postc=' + postc + '&huisnr=' + huisnr,
success: function(result) {
if(result.postcode == postc) {
$('#woonp').val(result.city);
$('#adres').val(result.street);
$('#provincie').val(result.province);
}
else {
alert('Postcode bestaat niet');
}
},
});
return false;
}
});
jQuery('input[name="postc"]').keyup(function() {
var length = $(this).val().length;
if(length <= 4) {
var num = jQuery(this).val().substring(0,4);
var return_num = num.replace(/[^0-9]/g,'');
jQuery(this).val(return_num);
}
else {
var num = jQuery(this).val().substring(0,4);
var alph = jQuery(this).val().substring(2,6);
var return_alph = alph.replace(/[^a-zA-Z]/g,'');
jQuery(this).val(num + '' + return_alph);
}
});
});
</script>
<form id="form" name="form" method="post">
<h1>Vul je postcode en huisnummer in</h1>
Postcode EN huisnr, anders doet ie het nie :)<br><br><br>
<label for="postc">Postcode:</label>
<input type="text" id="postc" name="postc" maxlength="10" placeholder="1234AB">
<label for="huisnr">Huisnummer:</label>
<input type="text" id="huisnr" name="huisnr">
<input type="submit" id="submit" name="submit" value="Zoeken">
<hr>
<label for="adres">Adres:</label>
<input type="text" id="adres" name="adres" disabled>
<label for="woonp">Woonplaats:</label>
<input type="text" id="woonp" name="woonp" disabled>
<label for="provincie">Provincie:</label>
<input type="text" id="provincie" name="provincie" disabled>
</form>
<script type="text/javascript">
$(function() {
$('#submit').click(function() {
var postc = $('#postc').val();
var huisnr = $('#huisnr').val();
if(!postc || !huisnr) {
alert("Je moet wel een postcode EN huisnr invullen.");
}
else {
$.ajax({
url: 'postcodeCheck.php',
type: 'GET',
dataType: 'json',
data: 'postc=' + postc + '&huisnr=' + huisnr,
success: function(result) {
if(result.postcode == postc) {
$('#woonp').val(result.city);
$('#adres').val(result.street);
$('#provincie').val(result.province);
}
else {
alert('Postcode bestaat niet');
}
},
});
return false;
}
});
jQuery('input[name="postc"]').keyup(function() {
var length = $(this).val().length;
if(length <= 4) {
var num = jQuery(this).val().substring(0,4);
var return_num = num.replace(/[^0-9]/g,'');
jQuery(this).val(return_num);
}
else {
var num = jQuery(this).val().substring(0,4);
var alph = jQuery(this).val().substring(2,6);
var return_alph = alph.replace(/[^a-zA-Z]/g,'');
jQuery(this).val(num + '' + return_alph);
}
});
});
</script>
<form id="form" name="form" method="post">
<h1>Vul je postcode en huisnummer in</h1>
Postcode EN huisnr, anders doet ie het nie :)<br><br><br>
<label for="postc">Postcode:</label>
<input type="text" id="postc" name="postc" maxlength="10" placeholder="1234AB">
<label for="huisnr">Huisnummer:</label>
<input type="text" id="huisnr" name="huisnr">
<input type="submit" id="submit" name="submit" value="Zoeken">
<hr>
<label for="adres">Adres:</label>
<input type="text" id="adres" name="adres" disabled>
<label for="woonp">Woonplaats:</label>
<input type="text" id="woonp" name="woonp" disabled>
<label for="provincie">Provincie:</label>
<input type="text" id="provincie" name="provincie" disabled>
</form>