doubledee Posted October 23, 2011 Share Posted October 23, 2011 I am building an Event Registration system, and am thinking that it should put the Attendee's name on the Ticket (and in the database) as a backup. Is there a way to easily (and dynamically) display the same number of Text-Boxes as the # of Attendees entered? For example, let's say the Customer (payor) wants to buy Tickets for herself and 5 friends to a Banjo Festival. Right now, I just have a drop-down box to capture the head-count, but it would be nice to have 5 Text-Boxes (or something appear) so that the Customer can easily type in the Names of the 5 Attendees *without* having to suffer numerous other clicks and/or screens. Follow me? Is there a way to do that? Thanks, Debbie Quote Link to comment https://forums.phpfreaks.com/topic/249621-dynamically-adding-text-boxes/ Share on other sites More sharing options...
watsmyname Posted October 23, 2011 Share Posted October 23, 2011 you can loop through the records and show textboxes equal to the number of records returned. and putting textbox name as array like this. <input type='textbox' id='something' name='something[]' value='{field returned from database}'/> And then you can loop through it in a submit page to save it back. Quote Link to comment https://forums.phpfreaks.com/topic/249621-dynamically-adding-text-boxes/#findComment-1281482 Share on other sites More sharing options...
Buddski Posted October 23, 2011 Share Posted October 23, 2011 I know you have an aversion to Javascript but its really the only way to do it without submitting the number of attendees first Quote Link to comment https://forums.phpfreaks.com/topic/249621-dynamically-adding-text-boxes/#findComment-1281483 Share on other sites More sharing options...
doubledee Posted October 23, 2011 Author Share Posted October 23, 2011 you can loop through the records and show textboxes equal to the number of records returned. and putting textbox name as array like this. <input type='textbox' id='something' name='something[]' value='{field returned from database}'/> And then you can loop through it in a submit page to save it back. You got it backwards... I need the Text-Boxes so I can gather Names to put INTO my database! Debbie Quote Link to comment https://forums.phpfreaks.com/topic/249621-dynamically-adding-text-boxes/#findComment-1281553 Share on other sites More sharing options...
doubledee Posted October 23, 2011 Author Share Posted October 23, 2011 I know you have an aversion to Javascript but its really the only way to do it without submitting the number of attendees first 1.) How hard would that be? 2.) What happens if the User has JavaScript turned off? 3.) Couldn't I capture the Event and # of Attendees on one page - which is what I have now - and then load a new page which has ____ Text-Boxes to add names? It is an extra screen, but maybe not so bad and it avoids the need for JavaScript, right? Debbie Quote Link to comment https://forums.phpfreaks.com/topic/249621-dynamically-adding-text-boxes/#findComment-1281554 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.