cmr Posted November 16, 2007 Share Posted November 16, 2007 Is there a better way to do it than i currently am using? Simply echos the value in the selected option that will otherwise be blank, so this makes it impossible for the user to select no input. Any help much apreciated. $e_s_y = $_POST['frm_e_s_y']; <select id="frm_e_s_y" name="frm_e_s_y"> <option selected="selected"><?php echo $e_s_y ?></option> <?php for($i=2007,$a=2015;$i<=$a;$i++) { echo "<option>$i</option>"; } ?> </select> Quote Link to comment Share on other sites More sharing options...
~n[EO]n~ Posted November 16, 2007 Share Posted November 16, 2007 You should check in a if... <select name="txttsttype" id="txttsttype"> <option value="1" <?php if($testtype=="1") echo "selected"; ?>>test1</option> <option value="2" <?php if($testtype=="2") echo "selected"; ?>>test2</option> </select> Quote Link to comment Share on other sites More sharing options...
cmr Posted November 16, 2007 Author Share Posted November 16, 2007 Nice one that should do nicely, should of come up with that myself guess i was being rather dumb Quote Link to comment 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.