harglefargle
Technical User
Ok, I know this can be done in JavaScript, which is fine if you have a small form or a limited number of options. But I recently saw a site that did this in php and I can't figure out how they pulled it off. Let's say you have a form that has 3 list boxes based on automotive choices. When the page first loads the first box is populated with broad options "Suv, Car, Truck" you get the idea. The next two boxes would be blank at that point. Now, let's say that you choose "Car" from the first box. Normally this would need to be submitted and the page would have to reload before the second box could be populated as the various types of cars are stored in a database. But on this site I saw the second box populates automatically without refreshing the page. Again, easy enough in JS but I had never seen it before using PHP. Likewise, when an option is selected from the now populated second list box the third box populates automatically. I guess what I'm wondering is how in the heck they managed to submit the selection to a php script and have it populate the next box w/out refreshing the page. All I can really tell is that they use the options in the list boxes as links to a php script and pass variables to the script based on the option selected. In my mind at least that would require a submission and as such a refresh. Someone educate me please.