Hi everybody.
I have 2 selects tag. first select is country list.
when user choses favorite country then the second select tag get new contents.

I can make this with javascript but I wanna make this just with php and without any scripts!

This is possible make this without any refreshing and reloading page? how?

Thanks for helping.

Recommended Answers

All 7 Replies

You could look at doing this using Ajax. This would mean a combination of Javascript and PHP though. Listen to the onchange event of the country list box, triggering the PHP script to run using Ajax and then processing the response using Javascript. The processing the response being populating the second list box.

This way, the page won't need to be reloaded.

Can't with pure php?

Member Avatar

You can't get the changed value of a dropdown in php unless you submit the form as you need to involve the server for php to run. You can use ajax (js/php/xml etc) or js

Thank you so much!

Member Avatar


No with pure php but I should to use js & php with together!

Thanks for helping.

Be a part of the DaniWeb community

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