Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

click list box dynamic update

click list box dynamic update

click list box dynamic update

Hi, I have a page with a list box on it that is filled with names from an MYSql database using php.

I need to be able to click on a name and have it display all the information for that individual(name, address, ect...) automatacly in a set of labels with out loading another page



RE: click list box dynamic update

Help ... I just need somebooooooooody

Now seriously, what did you try so far?


RE: click list box dynamic update

I have no idea where to start, I have never worked with AJAX before

RE: click list box dynamic update

Have you researched AJAX at all? There are many, many simple examples out there (e.g. at Tizag.com). What do you know about it so far?

As a general guide, you will need to:
a) create a new PHP script that receives a GET or POST parameter (presumably an ID representing a person), runs a MySQL query to retrieve a person's details corresponding to the passed ID, and returns a fragment of HTML (for example) ready to plugin to the page.

b) on your existing page create an onclick event handler and associate it with the listbox. The handler should instantiate the XMLHttpRequest object and send the request to the new PHP script, passing the appropriate parameter. It should also receive the resultset returned by the new PHP script and process it (e.g. dynamically insert the fragment of HTML into the page).

Once you understand the finer detail of how AJAX works, it might be worth using a higher-level implementation like jQuery. SitePoint have published a nice article entitled Easy Ajax with jQuery.

"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
To get the best answers from this forum see: FAQ102-5096: How do I get the best answers?

RE: click list box dynamic update

You can build the structure you need with this site.

it can handle the connected tables (Country)

Then you get a member updater code, where the connected table appears in a select box with the related value as selected.

That generator page has a video tutorial.

And example how the code looks like:

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close