Note that there are some explanatory texts on larger screens.

plurals
  1. POPassing Input From One Page To Another
    primarykey
    data
    text
    <p>I'm fairly new at this. I'm trying to build a store locator and trying to figure out how to pass an input value from one page to another page. User would input their zipcode or address in a form on one page and the map and locations would be called on another page using the input.</p> <p>I'm using ehound store locator platform (sample - here -> <a href="http://www.ehoundplatform.com/api/1....nd-google.html" rel="nofollow">http://www.ehoundplatform.com/api/1....nd-google.html</a>)</p> <p>The map/locator script is this</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"/&gt; &lt;title&gt;Store Locator Demo using FreeHound and Google Maps V.3&lt;/title&gt; &lt;style type="text/css"&gt; #map_canvas { height: 400px; width:710px; margin-bottom: 10px; } .addressBox { margin-bottom:10px; } &lt;/style&gt; &lt;script type="text/javascript" src="http://www.ehoundplatform.com/api/1.0 /proximity.js?key=xz396aw1qe432q1"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&amp;region=AU"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var geocoder; var map; var bounds; var markersArray = []; var infoWindow; var mapCenterLat = '-28.1594'; var mapCenterLon = '135.6456'; function initialize() { geocoder = new google.maps.Geocoder(); var myOptions = { zoom: 4, center: new google.maps.LatLng(mapCenterLat, mapCenterLon), mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); //initialise single info window to show only one at a time infoWindow = new google.maps.InfoWindow(); //improve usability by centering map around search point on zoom in/out google.maps.event.addListener(map, 'zoom_changed', function() { if(mapCenterLat &amp;&amp; mapCenterLon) { setTimeout('centerMap(mapCenterLat, mapCenterLon)', 300); } }); } function addMarkerOverlay(location, title, infoBox, image) { var marker = new google.maps.Marker({ position: location, map: map, icon: image }); marker.setTitle(title); google.maps.event.addListener(marker, 'click', function() { infoWindow.setContent(infoBox); infoWindow.open(map, marker); }); markersArray.push(marker); } function deleteOverlays() { if (markersArray) { for (i in markersArray) { markersArray[i].setMap(null); } markersArray.length = 0; } } function searchAroundMe() { deleteOverlays(); bounds = new google.maps.LatLngBounds(); var address = document.getElementById("address").value; geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); //custom marker to mark initial search location var image = new google.maps.MarkerImage('search_location.png', // This marker is 32 pixels wide by 32 pixels tall. new google.maps.Size(32, 32), // The origin for this image is 0,0. new google.maps.Point(0,0), // The anchor for this image is the center of the red circle at 16,16. new google.maps.Point(16, 16) ); addMarkerOverlay(results[0].geometry.location, 'search spot', 'search initiated from here', image); bounds.extend(results[0].geometry.location); var searchLatitude = results[0].geometry.location.lat(); var searchLongitude = results[0].geometry.location.lng(); mapCenterLat = searchLatitude; mapCenterLon = searchLongitude; freeHound = new FreeHound( 'showLocs' ); search = new FH_Search(); search.count = 10; //number of locations to be returned in the result set search.max_distance = 0; //distance limit for proximity search in km, 0 for unlimited //search from a specific point using latitude and longitude of that point search.point = new FH_Location( new FH_LatLon( searchLatitude,searchLongitude ) ); //search.filters = new Array(); //search.filters.push( new FH_SearchFilter('cat_id', 'eq', '177') ); search.create_log = false; freeHound.proximitySearch( search ); } else { alert("Geocode was not successful for the following reason: " + status); } }); } function showLocs(response){ if ( response.error_code ) { alert(response.error_message); } if ( response.record_set ) { //show results in a table var resultsTable = '&lt;table border="1" cellspacing="0" cellpadding="3" summary=""&gt;'; resultsTable += '&lt;tr&gt;'; resultsTable += '&lt;td&gt;#&lt;\/td&gt;'; resultsTable += '&lt;td&gt;Street Address&lt;\/td&gt;'; resultsTable += '&lt;td&gt;Town/Suburb/City&lt;\/td&gt;'; resultsTable += '&lt;td&gt;Postal Code&lt;\/td&gt;'; resultsTable += '&lt;td&gt;State/Province&lt;\/td&gt;'; resultsTable += '&lt;td&gt;Distance&lt;\/td&gt;'; resultsTable += '&lt;td&gt;Longitude&lt;\/td&gt;'; resultsTable += '&lt;td&gt;Latitude&lt;\/td&gt;'; resultsTable += '&lt;\/tr&gt;'; for (var record_count = 0, rl = response.record_set.length; record_count &lt; rl; record_count++ ) { var record = response.record_set[record_count]; var title = record.details.location_name; var infoBoxContent = '&lt;strong&gt;Location #'+(record_count+1).toString()+'&lt;\/strong&gt;'; infoBoxContent += '&lt;br \/&gt;'+record.address.street_address+'&lt;br \/&gt;'+record.address.town + ', ' + record.address.postal_code +'&lt;br \/&gt;'; infoBoxContent += 'Distance: '+record.distance.km+'km&lt;br \/&gt;'; addMarkerOverlay(new google.maps.LatLng(record.latitude, record.longitude), title, infoBoxContent, null); if (record_count &lt; 6) { bounds.extend(new google.maps.LatLng(record.latitude, record.longitude)); } resultsTable += '&lt;tr&gt;'; resultsTable += '&lt;td&gt;'+(record_count+1).toString()+'&lt;\/td&gt;'; resultsTable += '&lt;td&gt;'+record.address.street_address+'&lt;\/td&gt;'; resultsTable += '&lt;td&gt;'+record.address.town+'&lt;\/td&gt;'; resultsTable += '&lt;td&gt;'+record.address.postal_code+'&lt;\/td&gt;'; resultsTable += '&lt;td&gt;'+record.address.state+'&lt;\/td&gt;'; resultsTable += '&lt;td&gt;'+record.distance.km+'KM&lt;\/td&gt;'; resultsTable += '&lt;td&gt;'+record.longitude+'&lt;\/td&gt;'; resultsTable += '&lt;td&gt;'+record.latitude+'&lt;\/td&gt;'; resultsTable += '&lt;\/tr&gt;'; } map.fitBounds(bounds); resultsTable += '&lt;\/table&gt;'; var resultSet = document.getElementById('resultSet'); resultSet.innerHTML = resultsTable; } } function centerMap(lat,lon) { var centrePoint = new google.maps.LatLng(lat,lon); map.setCenter(centrePoint); } &lt;/script&gt; &lt;/head&gt; &lt;body onload="initialize()"&gt; &lt;div class="addressBox"&gt; &lt;form action="" onsubmit="searchAroundMe(); return false;"&gt; &lt;input id="address" type="textbox" value=""&gt; &lt;input type="submit" name="search" value="Address Search"&gt; &lt;/form&gt; &lt;/div&gt; &lt;div id="map_canvas"&gt;&lt;/div&gt; &lt;div id="resultSet"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and the form itself would be on another page. Trying to pull the address input over. This obviously doesn't work</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;KOI Store Locator&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;form action="ehound.php" method="post"&gt; &lt;input id="address" name="address" type="textbox"&gt; &lt;input type="submit" name="search" value="Address Search"&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I've looked around on passing inputs via php and such, but this script seems to call on javascript as well and I'm having trouble implementing anything that works. Any help would be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload