-4

I have an HTML form. It has select list and a text box and so on.

What I want is, upon selecting an option, the text box must be populated with data (from a mysql database).

What programming language do I use? If there is any example, can somebody please give me a link. I am a newbie and have learnt only PHP and MySQL.

Thank you.

4
  • you r taged answers... Commented Apr 9, 2014 at 6:18
  • 1
    Check this post for ajax stackoverflow.com/questions/16707648/… Commented Apr 9, 2014 at 6:19
  • Ajax is your friend in this case. Commented Apr 9, 2014 at 6:21
  • Thank you all. I shall learn AJAX first! Commented Apr 9, 2014 at 7:07

3 Answers 3

2

You will have to use Ajax (javascript) for it.

Like other Objects in javascript. Javascript has a XMLHTTPRequest Object. This allows code running on the browser to send requests to the server. The server must be coded to receive the requests, interact with the database, and return the results.

Sign up to request clarification or add additional context in comments.

1 Comment

1. There is no javascript. There is no Javascript either. 2. The term “Ajax” is a misnomer. XMLHttpRequest is an interface of a language-neutral API (introduced with MSXML for Microsoft Exchange). It is not part of ECMAScript and its implementations. It is only the fact that ECMAScript implementations, like JavaScript™, have become the best supported programming languages in Web browsers that makes this feature closely related to them.
0

try this

http://www.dotnetcurry.com/showarticle.aspx?ID=515

http://www.codeproject.com/Articles/78704/Different-Approaches-for-Implementing-the-JQuery

and in this method you can try populating your textbox

success: function (data) {
                            response($.map(data, function (item) {
                                return {
                                    label: 'Item text: ' + item[0],
                                    value: 'Item number: ' + item[1]
                                }
                            }));
                        }

Comments

0

Your buddy will be AJAX which can be performed using jQuery quite easily. It then might look like the following:

$('#my_select').on('change',function() {
    $.ajax({
        type: "GET",
        url: 'somefile.php',
        data: "id=" + id,
        success: function(data) {
            $('#textbox').html(data);
        }
    })
});

https://api.jquery.com/jQuery.ajax/ https://api.jquery.com/load/

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.