开发者

Letting PHP select an option in real time?

I'm building a CMS that have 2 database tables, subjects & pages ... I have two drop down lists..And i want to let the user to insert values in it ...

The first drop down list is to select which table to insert in. The second drop down list is to select the position of the inserted item in that selected table.

So I want the user to select the table first, then -using PHP- change the second drop down list to contain the available position in that table. Note that all the previous stuff is in the same web page without pressing any button or something.

So all I want, a method to make PHP check the selected option in the first drop down list, and change the options in the second开发者_StackOverflow according to the first drop down list, all that in the same page without pressing any button..

Is that possible in PHP ?


You can use PHP in the background, but as selecting an option happens on the client side you'll have to use a combination of JavaScript/Ajax.

Have a look at YUI Autocomplete or other Ajax autocomplete frameworks.


The short answer to your question is no. PHP is server side, i.e. it can't be changed by user interactions without refreshing the page as it has finished executing before the HTML reaches the browser.

To do this you will need to use javascript and ajax.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜