how to execute a query depending on the value selected

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kaif
Forum Newbie
Posts: 12
Joined: Thu Jan 06, 2011 11:12 pm

how to execute a query depending on the value selected

Post by kaif »

hi,

how to populate the other fields by executing a query depending on the value selected in the list box.

I have a list box which is getting the values from the database.

For example:

student Id

st01
st02
st03

if the user selected st01 in the list it should populate the the student name and branch in the below two text boxes

Thanks
Samiuddin
mellowman
Forum Commoner
Posts: 62
Joined: Sat Nov 22, 2008 5:37 pm

Re: how to execute a query depending on the value selected

Post by mellowman »

This seems to be more of a javascript along with php then just php...i suggest you look into a Jquery plugin...sense its the easiest and most likely someone has already created the code for you...it might need some manipulation though. :D
User avatar
awebtech
Forum Newbie
Posts: 21
Joined: Sun Nov 07, 2010 4:54 pm
Location: Russian Federation

Re: how to execute a query depending on the value selected

Post by awebtech »

If you want to populate fields without page refresh - ajax is your choice. And you can use jQuery methods (get, post, ajax) to work with ajax on the "high" level.
kaif
Forum Newbie
Posts: 12
Joined: Thu Jan 06, 2011 11:12 pm

Re: how to execute a query depending on the value selected

Post by kaif »

Thanks a lot for your response,

I don't know the ajax programming. :(

Please can you provide me the code

Once again thanks for your response
User avatar
awebtech
Forum Newbie
Posts: 21
Joined: Sun Nov 07, 2010 4:54 pm
Location: Russian Federation

Re: how to execute a query depending on the value selected

Post by awebtech »

You are welcome.

Actually, ajax is not complicated technology.

Just read few tutorials, like this one:
http://www.developertutorials.com/tutor ... query-874/
or this one:
http://articles.sitepoint.com/article/ajax-jquery
kaif
Forum Newbie
Posts: 12
Joined: Thu Jan 06, 2011 11:12 pm

Re: how to execute a query depending on the value selected

Post by kaif »

hi, awebtech

Very very Thanks :D
Post Reply