Alexhoward Posted May 25, 2008 Share Posted May 25, 2008 Hi guys, hoping someone here might have an idea about this one... I looked around the internet but can't find a soulution... Basically does anyone know how to set a default value to a select drop down box? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/107239-solved-select-box-default-value/ Share on other sites More sharing options...
Fadion Posted May 25, 2008 Share Posted May 25, 2008 U mean: <option value="php" selected="selected">PHP</option> Thats basically a selected value among all the other options, which will show as selected by default. Hope its what u meant. Link to comment https://forums.phpfreaks.com/topic/107239-solved-select-box-default-value/#findComment-549830 Share on other sites More sharing options...
Barand Posted May 25, 2008 Share Posted May 25, 2008 By default the first option is shown as selected, otherwise the one with the "selected" attribute set is shown as selected. But this is basic HTML, not PHP. Link to comment https://forums.phpfreaks.com/topic/107239-solved-select-box-default-value/#findComment-549833 Share on other sites More sharing options...
Alexhoward Posted May 25, 2008 Author Share Posted May 25, 2008 Nice one! so if i just bang the php in there to grad a number from mysql, that's what it'll show! e.g. <option value="<?php ?>" selected="selected"><?php ?></option> however, this would put the number in twice...? for example php "selected", 1,2,3,4,... but i can live with that! cheers Link to comment https://forums.phpfreaks.com/topic/107239-solved-select-box-default-value/#findComment-549838 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.