|  | Posted by Jerry Stuckle on 01/14/08 22:58 
wes.waters@gmail.com wrote:> First post here, so please go easy on me.  I'm certainly a novice at
 > best using PHP/MySQL.
 >
 > I have a table containing ID_NO, Name, SPRIDEN_ID.  This table
 > contains information about event attendees.  This data must later be
 > cleansed and SPRIDEN_ID should be added to this table if the attendee
 > is a constituent of ours or set to NULL (rather than deleted) if they
 > are not a constituent.
 >
 > Since I am using MySQL and PHP I have created a web form that allows
 > the data to be cleansed.  The PHP page simply extracts all attendee
 > information where the SPRIDEN_ID is not NULL or = 0 (as the column is
 > defined as INT, this is the default) and creates a php table where
 > each row provides the option to 1. input a SPRIDEN_ID in a text field
 > or 2. mark the SPRIDEN_ID as null via a checkbox.  The user should
 > have functionality that will allow them to cleanse however many rows
 > they so choose in one sitting, adding SPRIDEN_ID or marking SPRIDEN_ID
 > as NULL until an indefinite point, then press submit and have the
 > updates applied using MySQL to the database table, whether they have
 > cleansed all the rows of data or not.
 >
 > Since this is a webform that is built off dynamic content, it creates
 > a row in the php table for every row in the database table where the
 > SPRIDEN_ID meets the above criteria.  The field names, however, are
 > named the same thing over and over.  I have found that this does not
 > work well, as the $_POST array reads these are key collisions and only
 > stores the final instance.  What is the optimal way to name my form
 > fields here?  Should I prepend an iterated number to each form field
 > name and then split it out into an associative array while reading the
 > $_POST data?  Should I use php EXTR_PREFIX_ALL?
 >
 > I have found little documentation on this problem and have been
 > searching for awhile.  Any help would be greatly appreciated.
 >
 
 First of all, NULL is not the same as 0.  0 is a value.  NULL is
 specifically the lack of a value, and is handled differently.
 
 As to your problem - does each row have a unique id (primary key)?  If
 not, it should have.
 
 I normally build the name of the checkbox by concatenating the id to a
 prefix.  Then it's an easy job to split off the id which needs to be
 checked.
 
 --
 ==================
 Remove the "x" from my email address
 Jerry Stuckle
 JDS Computer Training Corp.
 jstucklex@attglobal.net
 ==================
  Navigation: [Reply to this message] |