[View
demo of inline postcode selection list using AJAX]
The above functionality can be installed in minutes....in 5 easy
steps.....
The
above Postcode Lookup for full Address search functionality can be
added to a web page in minutes. It is an "Out of the
Box" solution, no PHP programming is required.
Advantages
-
"Out of
the box" Full Postcode Address Search solution
-
No PHP
programming required, easily customised by editing file
simple parameters.
-
Quick
to install
-
Easily
customisable
window, [More
Info]
-
Will
run on most Web servers
-
Not
blocked by Pop-up blockers
-
Data always up
to date
-
No Data
Administration Cost for you
[AJAX
Inline version of this] [Classic
ASP
version of this] [.NET
version of this]
Step1: Download the Example Code
Simply
download the code. The code is in the "PHP Full
Address Web Pop-up" directory of our example
downloads. Copy the files from the "PHP Full Address
Pop-up" directory of your web page you want to add Postcode
Lookup.
[Click
here to download the Examples]
Step 2 : Add our code to your page
Then
on your web target page, copy the code from "defaults.htm",
marked "START OF POP-UP CODE"
to "END OF POP-UP CODE". To the bottom of your
web page, just above
"</body></html>". This will add the
necessary code to allow the Postcode
Lookup Web pop-up address search functionality.
Step 3 : Add a Link, button or image to activate Postcode
Lookup
Then
add
either a link, using the following code to activate the Postcode
Lookup Web pop-up:
Example link to activate Postcode Lookup Window:
<a
href="javascript:loadwindow(
'SimplyLookup1/simplypostcode_Address1.php',420,450)"
>Lookup
Address from link</a>
Example Button to activate Postcode Lookup Window:
<input
type=button value="Lookup Address"
onClick="javascript:loadwindow(
'SimplyLookup1/simplypostcode_Address1.php',420,450)">
This
could easily be changed to use a image.
Step 4 : Map your Address fields
Now
edit the JavaScript at the end of file
"simplypostcode_Address2.php", to write the correct
address lines, which result from the Postcode
Lookup. Back to your target web page, address fields:
Example address field mappings:
<script>
window.parent.document.forms[0].T1.value = Company
window.parent.document.forms[0].T2.value = Line1
window.parent.document.forms[0].T3.value = Line2
window.parent.document.forms[0].T4.value = Line3
window.parent.document.forms[0].T5.value = Town
window.parent.document.forms[0].T6.value = County
window.parent.document.forms[0].T7.value = Postcode
window.parent.document.forms[0].T8.value = Country
window.parent.document.forms[0].T9.value = MultiLineAddress
...
</script>
Where
T1-T9 are the address fields you want to fill in on your web
page
The
"MultiLineAddress" variable shows how to assign the
address to a "Memo" field. Or in other words, a
field which holds all of the address information, which the user
searched for.
Step 5 : Specify then Data Key
Open
an account with us. Within seconds you will then
receive a data key, by e-mail, which should be put in "SimplyPostcode_Settings.php"
file. This key will enable your account, for a 30
day evaluation period.
[Open
your account]
Enter
Postcode "ZZ99" to use test data
Requirements:
[Click here to go to
PHP's web site]
-
The code should
be place in the same domain as your web page, else
the Postcode Lookup window will not be able to write data
back to parent page
-
Cookies are
required if used for Internal use, as user the must
be identifiable to comply with our End User Agreement
-
Cookies are NOT
required for Web use. The code will NOT
use cookies if you use a Web License data key
[What is the Web use, Internal use]
Compatibility:
- IE5+: IE 5 and above
- FF1+:
Firefox 1.0+. NS6+ and FF beta are assumed as well.
- Opr7+:
Opera 7 and above.
Optional Customisation
The
Pop-up window can be customised in many ways:

The
"SimplyPostcode_Settings.php" file defines the above
areas, which can be easily customised.
The
"SimplyLookupImages" sub-directory, contain the images
used to create the window appearance. You could
replace these to change the complete look of the DHTML Web
Pop-up window.
The
Simply Postcode Lookup code has been place in a sub-directory
called "SimplyLookup1". This allows two
different pop-ups to placed in the same directory. Simply
name the second Lookup "SimplyLookup2", and edit code
to call the PHP in that directory.
Additional Notes:
The
pop-up window is programmed to appear in the middle of the
browser window, but by altering the loadwindow
function the position can be set
function
loadwindow(url,width,height,xpos,ypos){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("SimplyLookupWindow").style.display=''
document.getElementById("SimplyLookupWindow").style.width=
initialwidth=width+"px"
document.getElementById("SimplyLookupWindow").style.height=
initialheight=height+"px"
document.getElementById("SimplyLookupWindow").style.left=xpos+"px"
document.getElementById("SimplyLookupWindow").style.top=ns6?
window.pageYOffset*1+ypos+"px" :
iecompattest().scrollTop*1+ypos+"px"
document.getElementById("SimplyLookupWindowFrame").src=url
}
}
The simply specify the x,y
co-ordinates in the open call (step 3)
<a
href="javascript:loadwindow(
'SimplyLookup1/simplypostcode_Address1.php',420,450,100,30)"
>Lookup
Address from link</a>
For more information on how the popup
window works see:
http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow.htm
Important Note about PHP:
PHP has a PHP.INI file which controls the
languages settings
The following should be on:
; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
allow_url_fopen = On
If this is off, then the code cannot get the address information from our server!
On most servers it is ON
|