wigwambam Posted April 14, 2011 Share Posted April 14, 2011 Hope I'm not in the wrong forum here as javascript is required, BUT my page is written in PHP and will need to work from any number of records from the database. Basically, I have a drop-down box that contains product sizes, for example:- Small Medium Large Extra Large If the user selects Large for example, I want to change 'Was Price', 'Now Price' and 'Product Code' displayed on the page. If they select another size from drop-down the prices and code need to change again. Posted in the PHP section as PHP code is needed as well. Any help much appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/233710-changing-multiple-text-labels-dynamically/ Share on other sites More sharing options...
monkeytooth Posted April 14, 2011 Share Posted April 14, 2011 The actual changing of the DOM elements is JavaScript specific.. I suggest implimenting a library like jQuery for your JavaScript and read up on the either .get() .post() or .ajax() functions from that library see which one suits your needs better. As for the PHP needed to do it, its nothing special. Its the same php you'd use to load the page initially based on one specific default choice setting. The use of the above mentioned would be what sends something to the php file that pulls that information, sends the databack for the javascript to change the elements with the new data. So if you can do it with PHP already then your all set, and this is solely a javascript issue at that point. If your that new to PHP/mySQL however and don't know how to begin. Give us what you've attempted thus far so we can try to sort it out and help you fix/build what you want. Quote Link to comment https://forums.phpfreaks.com/topic/233710-changing-multiple-text-labels-dynamically/#findComment-1201531 Share on other sites More sharing options...
wigwambam Posted April 14, 2011 Author Share Posted April 14, 2011 Thanks for the reply. I can get a text field to change if the user selects a different size. What has me stumped is how to change multiple fields. Am going to try a new function, will let you know how I get on. Quote Link to comment https://forums.phpfreaks.com/topic/233710-changing-multiple-text-labels-dynamically/#findComment-1201539 Share on other sites More sharing options...
cyberRobot Posted April 14, 2011 Share Posted April 14, 2011 What does your code to change the field(s) look like? It might be helpful to post the HTML form code also. Quote Link to comment https://forums.phpfreaks.com/topic/233710-changing-multiple-text-labels-dynamically/#findComment-1201562 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.