brob Posted February 21, 2007 Share Posted February 21, 2007 Hi does anyone know of any good tutorials to show how to populate a page based on what is selected via a drop down without submitting to a new page? Cheers Link to comment https://forums.phpfreaks.com/topic/39455-dynamic-page-population-with-drop-down/ Share on other sites More sharing options...
monk.e.boy Posted February 21, 2007 Share Posted February 21, 2007 if you are not posting the results of the drop down back to the server, then you need to use client side stuff (javascript + DHTML) monk.e.boy Link to comment https://forums.phpfreaks.com/topic/39455-dynamic-page-population-with-drop-down/#findComment-190377 Share on other sites More sharing options...
skali Posted February 21, 2007 Share Posted February 21, 2007 If you want not to submit page neither on same page nor on any other page then the solution is AJAX. A basic tutorial can be found here: http://www.w3schools.com/ajax/default.asp If you want it to be submitted to the same page where the dropdown is located then you will need a javascript function. This javascript function will take data 'id' i suppose from your dropdown and will refresh the page with the value from the dropdown in the url. <script language="javascript"> function refresh_page(dropdown){ var id = dropdown.options[dropdown.options.selectedIndex].value; location = 'pageurl.php?id='+id; } </script> on your dropdown list you can use onchange event. onchange="refresh_page(this);" Link to comment https://forums.phpfreaks.com/topic/39455-dynamic-page-population-with-drop-down/#findComment-190469 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.