Forums

This topic is locked

Search box returning value

Posted 02 Apr 2007 15:43:28
1
has voted
02 Apr 2007 15:43:28 michael squire posted:
<font face='Arial'>I want to be able to set up a search box on my web site which allows users to enter a post code then this redirects them to a certain URL based on that post code they enter. I do not want a drop down list as there are over 5000 post codes and it would not present itself very well. Not too competent on mysql but wondering if there was a simple code whereby I could compose a table or similar?
</font id='Arial'>

Replies

Replied 03 Apr 2007 18:23:22
03 Apr 2007 18:23:22 Alan C replied:
Set up a form with a textbox for the postcode so that the user can enter it, the form action needs to point to the php file that is going to process it.

When the POST data arrives from the form, first examine it to determine that it really is a postcode and not some junk, then perform the query looking for it with a SELECT

All of that should be reasonabley straightforward with DW although you might need a function to check the postcode.

You could add a javascript in the page too so that the postcode is checked when the submit button is clicked, that way the user can correct it before it goes to the server.

Reply to this topic