Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6756363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:30:54+00:00 2026-05-26T13:30:54+00:00

I have a form field where someone can post a google maps (html) url

  • 0

I have a form field where someone can post a google maps (html) url which I then want to put into the database. Then I am retrieving it to use the html embedded map directly on my page. I have tried using urlencode() and htmlspecchars() but:

a) I’m not sure if $_POST is mishandling the data in the first place
b) I’m not sure the best way to store a long url like this in mySQL

The database entry is fine, it goes in, but not all of it. Not sure where it’s getting chopped up. My db col is VARCHAR set to 4000.

html:

<p class="form-title">Google map link</p>
<textarea id="map_link" cols="100" rows="5" name="maplink_entry"></textarea>

php database entry:

$map_link_entry = $_POST['map_link_entry'];
$safe_map_link_entry = mysql_real_escape_string($map_link_entry);
$query_do_entries = mysql_query("INSERT INTO all_places VALUES ('',(NOW()), '$address_entry','$safe_map_link_entry', '$username_entry', '$like', '$dislike', '$source')");

php database retrieval:

$result = '';

while ($row = mysql_fetch_assoc($query)) {
  $result .= '<li>';      
  $result .= stripslashes($row['map_link']);  
  $result .= '</li>';
 }

Roughly, a gmaps url is around 1134 chars but this is all I get back out:

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q

Any help much appreciated…thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:30:55+00:00Added an answer on May 26, 2026 at 1:30 pm

    I solved this by using PHP to regenerate all the map code, and just added in the user’s search terms stored in the database. This is better than storing the entire link which is unnecessary and cumbersome to prepare in PHP anyway.

    This also means the user does not need to get and post an entire google maps link. I just ask them for a location, then attempt to refine it using the googlemaps query strings (http://querystring.org/google-maps-query-string-parameters/).

    Final output code is:

    // set up variables
    $output = '';
    $map_width = '600';     // map frame width
    $map_height = '350';    // map frame height
    
    while ($row = mysql_fetch_assoc($query)) {
    
        $location = stripslashes($row['location']);
        $city = stripslashes($row['city']);
    
        // compile resulting html with variables and db results
        $output .= "<iframe width='" . 
                    $map_width . "' height='" . $map_height . 
                    "' frameborder='0' scrolling='no' 
                    marginheight='0' marginwidth='0' src='"; 
    
        // the original search query (googlemaps api uses "q=...")          
        $output .= "http://maps.google.com/maps?q=" . $location;
    
        // location to refine the query (googlemaps api uses "near=...")
        $output .= "&amp;near=" . $city;    
    
        // set map to 'terrain'                     
        $output .= "&amp;t=p";  
    
        //zoom level            
        $output .= "&amp;z=15";                         
        $output .= "&amp;output=embed'></iframe>";  
    
        $output .= "<br /><small><a href='" . $location . 
                    "&amp;output=source' target='_blank' 
                    style='color:#0000FF;text-align:left'>
                    View Larger Map</a></small>";   
    }
    
    // print it all out
    echo $output;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form field which requires a json object as its value when
I have form where user submits field. Field can have letters, numbers, and punctuation.
I have a page which displays a form that a logged-in user can use
Can someone please explain this to me? I have the following code: <form action=<?php
I have a dijit.form.NumberTextBox input field that starts out with these parms: new dijit.form.NumberTextBox({
I have a form that I am using to try and update a field
I have a form with a hidden Came from Adwords field that will be
I have a form and one of the fields is a check-all-that-applies type field
I have a rails form with a datetime_select field. When I try to submit
I have a Django form that uses an integer field to lookup a model

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.