kyleldi Posted March 11, 2009 Share Posted March 11, 2009 So I've got this form that has a drop down menu, pulling data from the db. What I want to do is create a static value, "Other" and use PHP to display a new field underneath the drop-down for the user to enter in the value for "other" if it is selected. Is this possible, and if so how would I go about it? Thank You! <label><select name="material" id="material"> <option value="No Material Chosen">- Material Types -</option> <?php do { ?> <option value="<?php echo $row_rs_materials['material']?>"><?php echo $row_rs_materials['label']?></option> <?php } while ($row_rs_materials = mysql_fetch_assoc($rs_materials)); $rows = mysql_num_rows($rs_materials); if($rows > 0) { mysql_data_seek($rs_materials, 0); $row_rs_materials = mysql_fetch_assoc($rs_materials); } ?> <option value="Per Print">Per Print</option> </select></label> Link to comment https://forums.phpfreaks.com/topic/148931-solved-php-form-help/ Share on other sites More sharing options...
lonewolf217 Posted March 11, 2009 Share Posted March 11, 2009 i think you can use javascript for this. have an extra form field below the dropdown and make it hidden by default. in the dropdown, when Other is selected, have it execute a javascript function that will make the extra form field show up` Link to comment https://forums.phpfreaks.com/topic/148931-solved-php-form-help/#findComment-782010 Share on other sites More sharing options...
revraz Posted March 11, 2009 Share Posted March 11, 2009 Yep, that's how I did mine. Link to comment https://forums.phpfreaks.com/topic/148931-solved-php-form-help/#findComment-782025 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.