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

  • Home
  • SEARCH
  • 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 6176623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:08:00+00:00 2026-05-24T00:08:00+00:00

I wonder whether someone may be able to help me please. I’m currently working

  • 0

I wonder whether someone may be able to help me please.

I’m currently working on a website that through a User Input Form, XML and PHP, users will add and save google map information to my SQL database.

I’ve successfully been using one of the examples on the Google site which explains how to use PHP and XML to save user defined information to the database.

The example use the $GET method, but from the information I’ve been reading on the web, the $POST option does seem the better method to use.

However when I change my coding to the $POST method I can create a record on the database but the values keyed into the form are not copied scross to the database. I know that I’m perhaps making a really stupid beginners mistake, but I just wondered whether someone may be able to tell me what I need to do to get it to work.

I’ve included cut down versions of the files below.

Many thanks

Chris

HTML Form Submit Button

function savedata() { 
var locationname = document.getElementById("locationname").value; 
var returnedaddress = document.getElementById("returnedaddress").value; 

    var url = "phpfilename.php?locationname=" + locationname + "&returnedaddress=" +        returnedaddress;

downloadUrl(url, function(data, responseCode) { 
if (responseCode == 200 && data.length <= 1) { 
} 
}); 
} 

function downloadUrl(url, callback) { 
var request = window.ActiveXObject ? 
new ActiveXObject('Microsoft.XMLHTTP') : 
new XMLHttpRequest; 

request.onreadystatechange = function() { 
if (request.readyState == 4) { 
request.onreadystatechange = doNothing; 
callback(request.responseText, request.status); 
} 
}; 

request.open('POST', url, true); 
request.send(null); 
} 

function doNothing() {} 
</script>

HTML Form

 <body>
<label><br />
</label>
<form name="searchforlocationformgeocode" id="searchforlocationformgeocode"> 
<div>
<label for="address">
<div align="center">
  <p>Location Name</p>
  <p>
    <input name="locationname" type="text" id="locationname" size="80" />
    </p>
</div>
    <p align="left"><label>Returned Address</label>&nbsp;</p>
      <div align="left">
        <input name="returnedaddress" type="text" id="returnedaddress" size="100" />
    </div>

PHP File

    <?php
require("phpfilename.php");

// Gets data from URL parameters
$locationname = $_POST['locationname'];
$address = $_POST['returnedaddress'];

// Opens a connection to a MySQL server
$connection = mysql_connect ("xxxxxxxx", $username, $password);
if (!$connection) {
  die('Not connected : ' . mysql_error());
}

// Set the active MySQL database
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected) {
  die ('Can\'t use db : ' . mysql_error());
}


// Insert new row with user data
$query = sprintf("INSERT INTO tablename " .
         " (locationname, address) " .
         " VALUES ('%s', '%s', '%s' );",
         mysql_real_escape_string($locationname),
         mysql_real_escape_string($address));

$result = mysql_query($query);

if (!$result) {
  die('Invalid query: ' . mysql_error());
}

?>
  • 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-24T00:08:01+00:00Added an answer on May 24, 2026 at 12:08 am

    You are passing the values using a query string, to get them you need to use $_GET.

    var url = "phpfilename.php?locationname=" + locationname + "&returnedaddress=" +        returnedaddress;
    

    To use $_POST, instead of adding the encoded name/value pairs to the end of the URL, send them via the request.send() method:

    request.send("locationname=" + locationname + "&returnedaddress=" + returnedaddress);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder whether someone may be able to help me please. I've been working
I wonder whether someone may be able to help me please. I currently use
I wonder whether someone may be able to help me please with a error
I wonder whether someone may be able to help me please. I'm trying to
I wonder whether someone may be able to help me please. I've put some
I wonder whether someone may be able to help me please. I'm wanting to
I wonder whether someone may be able to help me please. I am using
I wonder whether someone may be able to help me please. I've put together
I wonder whether someone may be able to help me please. I'm using the
I wonder whether someone may be able to help me please. I'm using the

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.