blanktarget Posted November 4, 2003 Share Posted November 4, 2003 I have form data where one field is a multiple select. I\'ve set up a table for the multiple select data-\'group\', I have a table for the rest of the data-\'listing\'. I have a third table-\'link\' which has the primary keys from each of the other tables, group_id and listing_id, because I need each client\'s listing, which is phone, name, etc. to correspond with all of the groups that they select in the form. I have this layyed out as a script but it seems messy and I don\'t know if it will work as the database grows after connection and form validation: insert into table listing (column_1, etc) values ($name, etc) select * from listing order by \'listin_id\' limit 0, 1 //to get the last row? and then insert the groups selected with the listing_id for reference into the \'link\' table. Somehow this seems like it\'s almost there. That multi select is killing me, this should be easy. Quote Link to comment Share on other sites More sharing options...
Barand Posted November 4, 2003 Share Posted November 4, 2003 When you have a multiple select, give it an array name, like \'group[]\' When you process the form [php:1:491fe48a91]<?php $groups = $_POST[\'group\']; foreach ($groups as $group) { # insert a group record for value $group } ?>[/php:1:491fe48a91] Quote Link to comment Share on other sites More sharing options...
blanktarget Posted November 4, 2003 Author Share Posted November 4, 2003 will that put each group into the same field in the db? 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.