-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.

Sadikhasan
  • 18,365
  • 21
  • 80
  • 122
Deepak B M
  • 43
  • 2
  • 6

3 Answers3

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.

Paul
  • 26,170
  • 12
  • 85
  • 119
sushil bharwani
  • 29,685
  • 30
  • 94
  • 128
  • 1. [There is no javascript. There is no Javascript either.](http://PointedEars.de/es-matrix) 2. The term “Ajax” is a misnomer. [`XMLHttpRequest` is an interface of a *language-neutral* API](http://www.w3.org/TR/XMLHttpRequest) ([introduced with MSXML for Microsoft Exchange](http://msdn.microsoft.com/en-us/library/ms759148(v=vs.85).aspx)). 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. – PointedEars Apr 09 '14 at 06:29
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]
                                }
                            }));
                        }
Jahangeer
  • 94
  • 4
  • 20
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/

b4ttl3m4st3r
  • 106
  • 11