joshgarrod Posted June 9, 2009 Share Posted June 9, 2009 I have the need to set an options list to have a default value of a variable, normal input and text area fields work but the options list doesn't. what do I have to do? <select name="seller" onchange="MM_jumpMenu('parent',this,0)"> <option>Private</option> <option>Trade</option> <option value="<?php echo $seller; ?>" selected="<?php echo $seller; ?>"></option> Link to comment https://forums.phpfreaks.com/topic/161596-solved-setting-default-value-to-variable-in-form-option-box/ Share on other sites More sharing options...
coupe-r Posted June 9, 2009 Share Posted June 9, 2009 Im not at a computer to test this code, but shouldn't it look more like this? <option value="<?php echo $seller; ?>" selected="selected"><?php echo $seller; ?></option> Link to comment https://forums.phpfreaks.com/topic/161596-solved-setting-default-value-to-variable-in-form-option-box/#findComment-852699 Share on other sites More sharing options...
joshgarrod Posted June 9, 2009 Author Share Posted June 9, 2009 Great thanks, thats how it should be. thanks for your time Link to comment https://forums.phpfreaks.com/topic/161596-solved-setting-default-value-to-variable-in-form-option-box/#findComment-852705 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.