Jump to content

Changing multiple text labels dynamically


wigwambam

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.