Welcome Guest, Not a member yet? Register   Sign In
Pre-populate select and radio
#10

[eluser]jentree[/eluser]
I realize this is an old post but thought I'd give my solution for select inputs for anyone else who might come across this thread.

This is from an "update" screen, so I wanted to set the selected option based on what was coming back from the db.

Code:
<option value="My Value" &lt;?php echo ($mything[0]->value == 'My Value') ? 'selected="selected"' : '';  ?&gt;> My Value </option>


Messages In This Thread
Pre-populate select and radio - by El Forum - 10-22-2009, 03:33 PM
Pre-populate select and radio - by El Forum - 10-22-2009, 03:37 PM
Pre-populate select and radio - by El Forum - 10-22-2009, 03:44 PM
Pre-populate select and radio - by El Forum - 10-22-2009, 03:51 PM
Pre-populate select and radio - by El Forum - 10-22-2009, 04:04 PM
Pre-populate select and radio - by El Forum - 10-22-2009, 07:30 PM
Pre-populate select and radio - by El Forum - 01-05-2010, 07:17 PM
Pre-populate select and radio - by El Forum - 02-24-2010, 08:40 PM
Pre-populate select and radio - by El Forum - 04-21-2010, 02:51 AM
Pre-populate select and radio - by El Forum - 03-01-2012, 08:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB