Permabanned
- Joined
- 25 Oct 2004
- Posts
- 9,078
Hi,
Just been trying to get a drop down list working our site and while if got the initial part working fine.
Basically a drop down list that when an option is selected it populates a text box, problem im having now is that when the site is refreshed or loaded again the text box value remains correct but the drop down list is reset to option 1 rather than its correct value.
ive added an additional line of php code to try and rectify this by attempting to inject the selected"selected" value into the html by using this code.
$form is the template html used for the drop down list im using.
When i add this code, its not adding in the selected option at all.
Any idea's ? im fairly new to php, only been tinkering with it for a month/6 weeks at most.
Cheers
Just been trying to get a drop down list working our site and while if got the initial part working fine.
Basically a drop down list that when an option is selected it populates a text box, problem im having now is that when the site is refreshed or loaded again the text box value remains correct but the drop down list is reset to option 1 rather than its correct value.
ive added an additional line of php code to try and rectify this by attempting to inject the selected"selected" value into the html by using this code.
PHP:
$form = str_replace("<option value=".$this->userdata["paypal_email"], "<option value=".$this->userdata["paypal_email"]."selected=\"selected\"", $form);
$form is the template html used for the drop down list im using.
When i add this code, its not adding in the selected option at all.
Any idea's ? im fairly new to php, only been tinkering with it for a month/6 weeks at most.
Cheers