Monday, April 12, 2010

Searches using Online Forms with Wildcards - Forcing Required Name Fields to return Everyone with the Same Lastname

Ran across this gem recently while searching for information on a local site via a form.  This particular form required that you enter a lastname & a firstname in order to return any records.  Knowing that this form is connected to a database, I got lazy and decided to try wildcard characters for firstname (ok, I admit, I didn't know the firstnames for the records I was looking for).  So, for Firstname I tried: *  This didn't work.  Next I tried another common wildcard character: %  That didn't work either.  So, it occured to me to try: ** 
This worked!  The database returned all the records for the Lastname I was searching.  Not sure why * didn't work, but I figured maybe the form wasn't passing the * by itself, and putting ** forced it to pass the wildcard to the database??  Any ideas on this?

I also wonder if the webmaster intended on folks being able to search on Lastname alone?  :-O