Jump to content

Recommended Posts

Hello.

 

I'm having some problem at the moment.

Wath i want,

there is a form with 2 fields. Field 1 and 2.

Field 1 is a drop down list, the values are selected from the database.

Depending on the choise from field 1, I want to edit the query from field 2.

 

So to give an example, if the user set the value of field 1 to lol, the query to pick the data that can be used in field 2 should be like select * from table where .. = lol

 

The meaning of the query in the second field is to use ajax and create a suggestion list for the user so only.

 

I hope someone is able to help me.

Well you are right, you will need to implement the AJAX if you want to pull this off without reloading the page to do it. If you already know how to make your queries to mySQL via PHP then you are all set there in order to do work with AJAX you generally don't have to change how you work with your php, aside from how you output your data at the end of the run of the script. Meaning you generally leave it as raw as needed for sending back to the JavaScript so it can process the data and do with it as needed.

 

my suggestion to you is the same as I would say to anyone else wanting to pick up and start using AJAX. go out, grab the latest copy of the jQuery Library which is a extremely easy, stable, and expandable JavaScript library. It will make your life so much easier in the long run not having to worry as much about things like cross browser support and all else.

 

And with that I will follow it up with. When you get the jQuery Lib set up on your site.. google "jquery post()" "jquery each() and json" and find examples about those 2 particular things to implement what you are asking here.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.