I have a multisite setup and I am adding some additional information fields in the profile edit screen in my theme’s dashboard. I am primarily using text fields however I have a drop down selection menu for the author’s country
<select name="country" class="mid2" id="country" value="<?php echo $userdata->country ?>" style="width:150px;">
My problem is that if a user selects “Togo” for example it registers the change (I know this because it echoes it in the author’s bio page) but the default value in the drop down menu (In this case the United States) always stays the same.
Any ideas on how I can have it display whichever country the author has selected?
WordPress has a great little function built in for handling selections.
You can also check out these form handling functions:
Your HTML syntax is wrong as well. Per W3C, ‘value’ is not an attribute of the select tag. The value of a select is defined in the options of a select. It should look like this:
So you say it registers the change, so it doesn’t really sound like its a WordPress problem but here is how you would display that anyways.