Dropdown menu + refresh

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Dropdown menu + refresh

Post by Joe »

I have made a drop down in my form but I have bumped a small problem. I am wishing to show 'shipping costs' for each individual 'state' which is chosen (Australian states) and I thought of the idea where the page is refreshed after a state is chosen in order for the correct shipping costs to be shown. The best example I can give is when you sign up for an account (eg, hotmail) and after choosing an appropiate state the zip/postalcode changes automatically.

Sorry if this is a bad explination but it is the best I can do. :D

Regards


Joe 8)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The basics of doing this can be found here: viewtopic.php?t=22055&highlight=onchange+select

there are 2 ways I can think of doing this: either submit the form as a partial, so all the challenge is on the form processor knowing it's partial (you can use hidden fields).. or you could store the shipping costs inside the select's values, and alter the page code via innerHTML/innerText and change the value of a hidden field (maybe)
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Thanks alot feyd. much appreciated :D
Post Reply