I have three element on a form, a dropdown box which gets values from a table and a textbox which will show the value based on the selection in dropdown, and a third textbox which is uses less at the moment.
What I want is that when I select any value from the dropdown box and submits the form the selected value disappears from the dropdown textbox and the first value of dropdown list appears.
I want that the dowpdown shold display the selected value upon submission of form.
What I want is that when I select any value from the dropdown box and submits the form the selected value disappears from the dropdown textbox and the first value of dropdown list appears.
I want that the dowpdown shold display the selected value upon submission of form.
Well I don't understand. First you said you want the selected value to disappear, then you said you want it to display.
You can use PHP to rewrite the list as you want, after the form is submitted.
Dear I want that When I choose a value from the options dropdown and the form is submitted, then the drop down does not show the value selected or chosen but the default value. e.g
the list contains A,B,C and I chose B, and the form is submitted, the dropdown should show the value B but it shows me A instead of B.
This would select value B as the default when that page is loaded. Do do this based on form data you could simply write a few if statements which puts the word 'selected' in the right option tag depending on the data.
Ryan is correct. Instead of using the javascript, just add to your PHP some code to rewrite the options list with the "selected" attribute added to the option that was selected from $_GET("opt").
Don't know if you realize this: onchange="submit();" will not submit your form - you need an form <input> button with type=submit.
Bookmarks