verdrm Posted August 31, 2007 Share Posted August 31, 2007 Hello, I would like to duplicate text fields and then insert that data into MySQL. So if I have one text field, I click for instance a plus sign and another text field appears. How would I go about doing that? Quote Link to comment https://forums.phpfreaks.com/topic/67410-duplicating-fields/ Share on other sites More sharing options...
Psycho Posted August 31, 2007 Share Posted August 31, 2007 Well, you are asking two questions. Concerning adding a field, do you want to have a page refresh when the user clicks the plus sign? I would assume no since if you were going to submit the page you might as well add the first entry to the database and then show a new form. If that is the case, then you need to utilize javascript to dynamically add the field. I have a script at work which does exactly that. I would suggest naming all the text fields the same in an array format: <input type="text" name="datafield[]"> Then when the page is posted you can iterate through all of the datafield elements and save to the database. Quote Link to comment https://forums.phpfreaks.com/topic/67410-duplicating-fields/#findComment-338419 Share on other sites More sharing options...
verdrm Posted September 1, 2007 Author Share Posted September 1, 2007 As far as a page refresh, I would rather the field appear without a page refresh utilizing AJAX or JavaScript. Do you know where I might go to find a code that can do this? Quote Link to comment https://forums.phpfreaks.com/topic/67410-duplicating-fields/#findComment-339124 Share on other sites More sharing options...
Jessica Posted September 1, 2007 Share Posted September 1, 2007 Check out mootools.net Quote Link to comment https://forums.phpfreaks.com/topic/67410-duplicating-fields/#findComment-339125 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.