Jump to content

Dynamic Drop Down List


ankur218
 Share

Recommended Posts

Hello everyone,I am building a file uploading/download section for my University. I don't have much knowledge about JavaScript or PHP (very basic, that too only if I see the code at times).So I want it to be this way. The students go to the page and there they have about 3-4 drop down lists. First they have to choose which Engineering Department they belong to, then which semester they are in and accordingly the subjects show up, they choose the subjects, press the next or whatever button, they are redirected to a page where all the files are present.For example: Say I want to download the notes of Data Structures from 3rd sem. So there are 3 Engineering Courses, CSE, ECE and Mechanical. I choose CSE, when I choose CSE, in the next Drop down, 8 semesters are there in the list, I choose 3rd, all the 3rd sem subjects show up in the next list, I choose DS and then I click next to go to a page or directory where those files are present.Refer, BookMyShow site for a clear view of the picture.Can someone post a sample code for this please taking the above example. I googled, but didn't find convincing ones since I didn't have vast knowledge about JavaScript.Oh yeah, I am using Bootstrap from Twitter to design it. So for the dropdowns also I will use the same.Thank YouCheers^_^

Link to comment
Share on other sites

Do you know about ajax. By selecting from one drop down, other drop down will fill. For this you need ajax. Search this in google: dynamic drop down list using ajax. Hope you will get a nice code there.
He doesn't NEED AJAX, AJAX is just nice to have and use. (Heck he could even just use a nice little JavaScript/jQuery function to display a div full of the links documents once a dropdown is selected, without using AJAX at all)He can easily achieve this task with php, where it redirects them to a specific page depending on what drop down item they selected.But this can not be done just with HTML. Which method would you prefer? JavaScript/jQuery (Same thing just different coding syntax)orPHP
  • Like 1
Link to comment
Share on other sites

With Shadow's link, which is what I was referring to when I said to just use JavaScript, is perfect. Only thing to be careful of (maybe the guy went over it on that blog post, I skimmed over it so I might of missed it) is that you need to have fall back for the odd users that have JavaScript disabled. How do you do this? Well in your javascript you either hide the submit button, or you return false the submit, either way you need a way to submit the drop down selection to a php file that will display the correct files.

Link to comment
Share on other sites

Only thing to be careful of (maybe the guy went over it on that blog post, I skimmed over it so I might of missed it) is that you need to have fall back for the odd users that have JavaScript disabled. How do you do this? Well in your javascript you either hide the submit button, or you return false the submit, either way you need a way to submit the drop down selection to a php file that will display the correct files.
"The guy" in that blog is our very own Dierdre's Dad. Sophox is his blog. This is the very reason I trust the content there. ^_^ I don't think he mentions anything about having a fallback, but that is definitely something to keep in mind.
  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...