Solved

Google XML Issue - Results not working as expected...

Posted on 2012-03-27
14
580 Views
Last Modified: 2013-12-25
Hello,

I have created a web page that returns a list of locations from Google Maps, when there are more than one result found, however when clicking on one of the results to confirm which I want, it doesn't seem to listen and simply reloads the page.  I have tried to alter the 'h ref' and direct the click straight to the confirmation page, however this unfortunately stops any of the code showing on the page, which is really strange...!

The HTML generated is:

<?xml version="1.0" encoding="ISO-8859-1"?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-32" />
<title>Searching Address</title>
</head>
<body>
<form name="form1" method="post">
Fürth, GermanyThe address you requested returned multiple possibilities:<p><p><a href="searchaddress.asp?address=Fürth, Germany">Fürth, Germany</a></p><p><a href="searchaddress.asp?address=Furth, Germany">Furth, Germany</a></p><p><a href="searchaddress.asp?address=Furth im Wald, Germany">Furth im Wald, Germany</a></p><p><a href="searchaddress.asp?address=Fürth, Germany">Fürth, Germany</a></p></p><P>If the address is not listed, please try again, perhaps adding in more information:<p> <input type="text" size="50" name="address" id="address" value="Fürth, Germany" /><input type="submit" id="searchagain" name="searchagain" value="Search Again" /></p>

</form>
</body>
</html>

I have attached the ASP page here too.

Thanks for your help!
0
Comment
Question by:Nico2011
  • 6
  • 3
  • 3
14 Comments
 
LVL 21

Expert Comment

by:Kim Walker
ID: 37771037
Could it be the spaces in your query string? Try url encoding the href.
0
 

Author Comment

by:Nico2011
ID: 37771235
Thanks but that doesn't work either...
0
 
LVL 21

Expert Comment

by:Kim Walker
ID: 37771285
Does the file "searchaddress.asp" have code to process the query string? You said you attached the asp page but I don't see an attachment.
0
 

Author Comment

by:Nico2011
ID: 37771329
Aha - I'm to EE, so didn't see the 'Attach' button after browsing - should have known better...!  Attached now!  

Yes, there is some code, but a redirect.  It's really strange because as soon as the page name is changed, the page no longer works at all...!  Essentially, it is sent an addess through a querystring, which it then processes.  If it finds the address first time, then it forwards the user to a page and shows this on a map, but if there are more than one result found for the location (such as furth in Germany) it loops back on itself.  Sometimes however, if there is a larger list of results, it will work - as in takes the address te user has clicked on as the correct one, and passes it to the next page with the map.

Thanks again!
searchaddress.txt
0
 
LVL 21

Expert Comment

by:Kim Walker
ID: 37771482
Unfortunately, it's been ten years or more since I last looked at ASP. I got involved in this question because JavaScript was listed as one of the topics. Perhaps an ASP expert will join in, but you may have to repost the question with a different title that will attract ASP experts.

From what I've been able to understand from your code and my experience with Google maps, I'm wondering if the addresses listed will always return multiple possibilities. Have you tried searching for one of the alternatives first? Does it still return multiple addresses? If so, you may have to include more than just the address in your secondary searches.

In your initial post, it appears you have started a search for "Fürth, Germany" and received four possibilities. However, the first and last possibility are exactly the same as the initial search. Clicking either of those choices will repeat the exact same process again since the query string for both is exactly the same as the initial request, "Fürth, Germany".
0
 

Author Comment

by:Nico2011
ID: 37771579
Thanks for your help.  I did try to add on the lng/lat to each line, but when I do that, the first record never has that information - the others do...

Yes, sometimes the address gets found and the page bounces straight through to the map page, and it's only when there are multiple possibilities that this problem occurs.

I'll do as you suggest and repost - sorry I put Javascript in the topics - I'm working on so many pages and didn't realise this one doesn't have javascript...!
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 45

Expert Comment

by:aikimark
ID: 37832322
do your links now look like this?
href="searchaddress.asp?address=Fürth,%20Germany"

Open in new window

0
 

Author Comment

by:Nico2011
ID: 37897416
Thanks - no they don't - they look like this: <a href="searchaddress.asp?location=Fürth, Germany">Fürth, Germany</a>

If I try to URL encode the URL, the page stops working altogether...!

(sorry I took so long to come back - I have been away)
0
 
LVL 45

Expert Comment

by:aikimark
ID: 37897551
If you have a search argument that doesn't include any space characters, does the link work?
0
 

Author Comment

by:Nico2011
ID: 37897613
nope - not at all...!  You can see what I'm up to at www.gorgeous-villas.com/index2.asp - try searching for Furth and you'll see the problem I'm having.  Thanks for your help!
0
 
LVL 45

Accepted Solution

by:
aikimark earned 500 total points
ID: 37897831
1. I think you should be using location= rather than address=
2. When you retrieve the data for the combobox, it would be better if you assigned the key value to each entry and do your search by the location key value, instead of the name of the location.
0
 

Author Closing Comment

by:Nico2011
ID: 37901611
That works!  BUT I did have to add in a procedure to prevent the name coming up loads of times - for some reason, Google Maps has the same name with multiple lng/lat addresses.  Most important thing is that it now works - thank you so much.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now