I am new to php and wanted to now, how can I add text fields at runtime. I have created a php page with a simple dropdown list in it.The dropdown list has numbers 1,2,3 and so on. What I want to do is that whenever a user selects a number from dropdown list, the same number of text fields (along with labels) appear. Example 1 textfield for 1 (with label), 2 textfields for 2 and so on . If someone can give me any code example or a link to understand, It will be very helpful . Thanks alot 🙂
Share
I would use jquery, a JavaScript library as Dagon suggested.
First your html:
Then your javascript (using jQuery):
For your reference:
http://api.jquery.com/change/
http://api.jquery.com/append/