verdrm Posted November 28, 2007 Share Posted November 28, 2007 Can you tell me how using JavaScript or PHP to duplicate text fields based on a pull down menu? For instance, if I choose '3' on a pull-down list and hit 'Update', the page will refresh with three text fields. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 28, 2007 Share Posted November 28, 2007 js can do this, php can just be really easy <?php if(is_numeric($_GET['field_count'])){ for($i = 0; $i <$_GET['field_count']; $i++){ echo "<input type=\"text\" name=\"text[".$i."]\" value=\"\" />"; } } else{ echo "<input type="\text\" name=\"text[0]\" value=\"\" />"; ?> 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.