I was trying to go about this another way. It might be the wrong way
but it seemed easier. Maybe not but I seem to be hung up in one spot.
Instead of changing the URL I was going to add a second text box for
the name in my case it is an agents name. This second form points back
to the same page to find a php script in the header. Then the php
script query find that name and the address that matches to it. Then I
wanted to call the java script function from within the web page with
the php writing to the searchLocations() function upon page load.
I made a second but almost identical function called searchLocations2
(). This does the exact same thing as the first, but receives the
variable dynamically after the form is submitted.
I put a document.write(address) after the variable is initialized to
ensure that it grabbed the address. For whatever reason though this is
where the program stops working.
the line - geocoder.getLatLng(address, function(latlng) {
appears to do nothing and I don't know why. Technically shouldn't it
create the map once I have fed it with the address variable? Any
ideas? I can paste code or give you the web site to look at.
Thanks,
Matt
On Mar 2, 10:39 am, Barry Hunter <[email protected]> wrote:
> Basic overview,
>
> 1)adda new textbox for 'namesearch'
>
> 2) create function that takes taht value and sends it to the server
> (much like the searchLocationsNear calls
> var searchUrl = 'phpsqlsearch_genxml_restaurant.php?lat=' +
> center.lat() + '&lng=' + center.lng() + '&radius=' + radius;
> you have
> var searchUrl = 'phpsqlsearch_genxml_restaurant.php?q=' + escape(query);
>
> 3) modify the php script to check if anameis included, if it
> issearchthenamefield, otherwise get the lat/long andsearchas per
> the tutorial.
>
> at the most basic you just do
> $sql = "... wherenamelike '%".mysql_real_escape_string($_GET['q'])."%' ";
> which will work for single keywords. Otherwise investigate the full
> textsearchoption in mysql .
>
> On 02/03/2009, Nathan <[email protected]> wrote:
>
>
>
>
>
> > So, I ran through the API tutorial to create a store locator, and it
> > worked like a charm. I have a MySQL database with 1000 or so
> > locations, and using the API example, I have everything set up to
> > searchby address, grab the locations from the database and show them
> > on a map. That works perfectly.....
>
> > But now I want toadda field tosearchbyname.
>
> > The client is a vodka producer. They want people to be able tosearch
> > by location (give me the nearest liquor store that has the product)
> > but also by storename(hey, I live by Joe's Liquor store, do they
> > have it?).
>
> > So, thenameof the store is in the db, but how do I do asearchby
> > it? I don't even know where to begin.
>
> > Here's the page that works to find a location by address:
> > http://www.doublecrossvodka.com/locator/find_restaurants.php
>
> > That page hits
> > thehttp://www.doublecrossvodka.com/locator/phpsqlsearch_genxml_restauran...
> > page
>
> > Any ideas?
>
> > Thank you so much.
>
> --
> Barry
>
> -www.nearby.org.uk-www.geograph.org.uk-
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---