tapupartforpres Posted August 25, 2008 Share Posted August 25, 2008 Hello people. I search and could not find a solution. Wondering if someone could help. Basically I am creating a form that people can fill to register for an event. They have the option to add a number of guests. Here is my question: 1. In the form if they have guests, how does one post that data to the SQL database so that I know who's guest goes with the main person who filled out the form? Link to comment https://forums.phpfreaks.com/topic/121291-posting-multiple-text-area/ Share on other sites More sharing options...
joquius Posted August 25, 2008 Share Posted August 25, 2008 Either you keep track of guests in a by giving your table a `guest_of` or `parent` field (whichever is more semantically pleasing for you), or if you only want the guests to exist for each person just add a guests field with comma separated names of the guests (guest1,guest2,guest3). Link to comment https://forums.phpfreaks.com/topic/121291-posting-multiple-text-area/#findComment-625281 Share on other sites More sharing options...
tapupartforpres Posted August 25, 2008 Author Share Posted August 25, 2008 Ok thanks. But one more quick question. How would I code that to relate back to the persons name as the primary poster. Thanks Link to comment https://forums.phpfreaks.com/topic/121291-posting-multiple-text-area/#findComment-625303 Share on other sites More sharing options...
DarkWater Posted August 25, 2008 Share Posted August 25, 2008 Either you keep track of guests in a by giving your table a `guest_of` or `parent` field (whichever is more semantically pleasing for you), or if you only want the guests to exist for each person just add a guests field with comma separated names of the guests (guest1,guest2,guest3). No no no, please don't do the CSV. Just make another table and do a join to get the guests for each person. Link to comment https://forums.phpfreaks.com/topic/121291-posting-multiple-text-area/#findComment-625315 Share on other sites More sharing options...
joquius Posted August 25, 2008 Share Posted August 25, 2008 You can use the same table and do a join to the same table. lets say `id`, `parent`, `name` SELECT t1.name as guest_name,t2.name as parent_name FROM table as t1 LEFT JOIN table as t2 ON t1.parent = t2.id WHERE t1.id = 'guests_id' sorry I can't follow up I'm off good luck... Link to comment https://forums.phpfreaks.com/topic/121291-posting-multiple-text-area/#findComment-625327 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.