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 Quote 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. Quote 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. Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.