tags:

views:

121

answers:

2

This is what I want my site to do:
1. User fills in some drop down menus
2. User clicks "Update Button"
3. Old Drop downs are disabled (but still visible), and new drop downs appear below with options based on the first drop down menus (in a way that i specify)
4. Repeat 1-3 a few times
5. User submits Data

My starting point I have been using is a page that sends POST data to itself, each drop down selection is saved into a var(ie. $A1 = $_POST[A_First]) and the new drop downs are populated with these vars (using a function i made). The page works nicely without disabling the Previous menus, but once i try to do that i run into problems (since disabled tables cannot be accessed via $_POST)

Does anyone have an idea on where i can look for a solution? Again, right now I have the menus, and the update button creating new menus, but it is only good if a user goes through the natural flow, If changes are made then errors can occur. I am looking for a way to stop a user from breaking the flow by disabling the previous menus.

Thanks

A: 

if you add session_start() to the top of your page you can store the previous form submission into the session array $_SESSION. sessions are made to store data between page loads while someone is on your site. You could then loop through anything saved in the sessions and re-display them disabled.

The other option would be to simply put any previous drop downs into both the disabled drop down and hidden form variables so they submit with your form with the value previously selected.

Jonathan Kuhn
Hey I am unfamiliar with $Session but it sounds like what i need. Ill look into it more, Thanks for the suggestion.I tried the second suggestion but couldnt get it to work.Would i make $A1 = $_POST[AFirstHidden] or still $_POST[AFirst] (AFirst being my dropdown menu) and if the first one, how would i set AFirstHidden.value = AFirst.value?
Josh K
Session Worked for me! Thanks a lot :)
Josh K
if you wanted to do the second option, you just add `<input type="hidden" name="AFirst" value="$_POST['AFirst']">` to the form for any of the already posted drop downs. I would personally probably just not add a name attribute for any disabled drop downs and give the hidden field the name the dropdown originally had (IE: AFirst). Then you don't need to check two values (hidden and not) after the form get submitted again.
Jonathan Kuhn
A: 

On your select html element, specify the "readonly" attribute. The dropdown will appear on screen and the value submitted via form posting, but will not be modifiable by the user.

Moot
i dont think the select html element contains the readonly element. I tried <select readonly='readonly'> but it didnt do anything.
Josh K