RE: [PHP] update query based on array

From: Date: Wed, 11 Dec 2002 06:03:58 +0000
Subject: RE: [PHP] update query based on array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-127760@lists.php.net to get a copy of this message
Thanks Mike, that fixed the problem that I had! Jason > -----Original Message----- > From: Ford, Mike [LSS] [mailto:M.Ford@lmu.ac.uk] > Sent: December 10, 2002 6:21 AM > To: 'Jason Dulberg' > Cc: php-general@lists.php.net > Subject: RE: [PHP] update query based on array > > > > -----Original Message----- > > From: Jason Dulberg [mailto:jdulberg@nas.net] > > Sent: 09 December 2002 23:52 > > > > So you mean do something like: > > > > <input type="text" name="category[15]" value="Prep > > School"> > > <input type="text" name="rank[15]" value=30 size=4> > > <input type="checkbox" name="rankid[15]" value="166"> > > > > Doesn't that create 2 additional arrays though? > > Yes -- but how else are you going to get multiple values for each > name from > your form to your PHP script? Without the array subscripts on > both category > and rank, you will only ever get one category and one rank passed to your > script. > > Using the above, just do: > > foreach ($_POST['rankid'] as $row, $rankid): > // in here, $rankid is the value of the current rankid[] > // $_POST['category'][$row] is associated category[] value > // $_POST['rank'][$row] is associated rank[] value > endforeach; > > Cheers! > > Mike > > --------------------------------------------------------------------- > Mike Ford, Electronic Information Services Adviser, > Learning Support Services, Learning & Information Services, > JG125, James Graham Building, Leeds Metropolitan University, > Beckett Park, LEEDS, LS6 3QS, United Kingdom > Email: m.ford@lmu.ac.uk > Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 >

« previous php.general (#127760) next »