Hello DaniWeb, I am working on project in which admin generates dynamic query by selecting value from the First dropdown(program) then second dropdown (semester). The concept is that
For example:
if admin select "MSCS" from the first dropdown list and "3" from the second dropdown list. it should populate all the students, subjects of third term.

secondly: the same is the case while inserting record into table all in one click.

Note: Subject varies from 4 to 6 each term.

Guide Me How Can I do this ?

Recommended Answers

All 4 Replies

What knowlodge do you have about HTML, JavaScript and PHP? Are you going to use AJAX?

The first thing you'll need to do is load the first select, then when it changes you fill the second select, then, when it changes, you fill the table.

It's hard to guide you without knowing what you already know or what you already have.

I you know nothing, then start by making the HTML with two selects and a table.

Got your idea. But i am stuck with how the data will be inserted ?

I have a good knowledge of HTML, JavaScript, PHP but less knowledge of AJAX.

Ok... so, using AJAX, in your case, the data will be inserted into DOM after the response from the HTTP request(ajax).

The simpliest way to insert data recieved from ajax is if that is already HTML, so you don't have to parse it, just insert.
Another way is to recieve an XML or JSON object and use JavaScript to parse into into HTML or even go trought it and insert separeted DOM nodes

I suggest you start by using jQuery ajax methods, it's easy to learn.

Take a look at this article: http://blog.teamtreehouse.com/beginners-guide-to-ajax-development-with-php
Or some more direct approach: http://brian.staruk.me/php/2013/sample-jquery-php-ajax-script/

There's lots of material about Ajax and PHP out there, some are really good.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.