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 8900043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:00:30+00:00 2026-06-15T01:00:30+00:00

Suppose the simple three input form below. Using the values of lat and lon

  • 0

Suppose the simple three input form below. Using the values of lat and lon I need to run a PHP function (already written) that creates the value I want in sitename. The current form action already works just fine, and does something completely different than my question.

<form name="w3Balltrak" class="feedbackform" action="readyget.pl" method="post"
<input type="text" id='lat' name='lat' value='' />
<input type="text" id='lon' name='lon' value='' />
<input type="text" id='sitename' name='sitename' value='' />
<input type="submit" value="Submit" /> 
</form>

My problem is I don’t know how to set the value of the sitename to the output of my PHP function. The function works great, a call to it in PHP would look like this ‘getWX($lat, $lon)’ and the return would look like this ‘MCI’.

How do I make the default value of sitename MCI immediately after the user enters a value in lon but before he hits the submit button at the end of the form?

I hope I asked this well enough for someone to understand and answer.

  • 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-06-15T01:00:32+00:00Added an answer on June 15, 2026 at 1:00 am

    As far as i understood your question .. your answer would be ajax

    <script type="text/javascript">
    // wait until the document ist ready.. otherwise the 2 ids dont exist in this moment
    jQuery(document).ready(function($){
        // on every change in the input fields send a request to the php
        $('#lat, #lon').live('change', function(){
            $.get("test.php", { lat: $('#lat').val(), lon: $('#lon').val() },
               function(data){
                 $('#sitename').val(data);
            });            
        });
    });
    </script>
    

    and in the test.php file

    <?php
    // if the 2 fields are not empty ... join them and return the result
    if(!empty($_GET['lat']) && !empty($_GET['lon'])){
        $result = $_GET['lat'] . $_GET['lon'];
    }
    echo $result; 
    ?>
    

    $result will then be what the jQuery function recives as “data”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

suppose I have a simple container which have three element: <div> <span>hello world</span> <input
Suppose you're writing a simple database web application using Ruby and MySQL. Access to
I am making a simple form with about eight input fields. I want the
I am working on a fairly simple demo app. Three input dropdown boxes are
Here is my HTML. Just a simple form: <form> Username: <input type=text id=username/> <br/>
Suppose I have a simple equation of the form: 7x + 4y = n
Lets suppose that I have simple html markup: <div> <input type=text/> </div> when I
You will suppose this is a big question.but there might be a simple problem
Suppose a simple ActiveRecord model corresponding to a table with just two columns, id
Suppose I have a simple model, such as Record: @Model public class Record {

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.