Is there something similar to runat server in php?

I’d like 2have a selection list option of the categories and a soon as the user clicks on one of the options i want him to get the sub-categories on a second menu list with having to click on a button or something… is such available in php similar to controls?

Thanks :slight_smile:

2 basic ways, both require javascript.

output all of the resulting sub cats into a javascript array.
when the user selects something from the 1st list, javascript makes the 2nd list visable and populates it with the appropriate choices. this would respond very fast, but you might have a very large javascript array depending on the size of your lists.

the other method is to use javascript to make an http request in the background. when the user selects something from the first list, javascript will send a request to a seperate php script with thier choice as the parameter. the php script would then return the data needed to populate the 2nd list. there would be a slight delay between selecting from the 1st list, to when the 2nd list becomes visable and populated, because an http request needs to be made. this method is known as AJAX.

can u give me an example on the 1st way? I have no previous experience in javascript…

You’re not gonig to have something this easy using just PHP by itself. Remember, .NET is a framework, not a language, so it can do extra add-ons like this and make it all easy to implement because it does all the javascript stuff for you. Using just PHP by itself, you will have to create all this functionality by hand, as calmcrusher described.

Edit: I would check a few javascript websites, such as or - also, you can always use a Google search.