RE: [PHP] Why does this happen?

From: Date: Mon, 10 Feb 2003 13:28:44 +0000
Subject: RE: [PHP] Why does this happen?
Groups: php.general 
Request: Send a blank email to php-general+get-135044@lists.php.net to get a copy of this message
> -----Original Message----- > From: CF High [mailto:noah@newminddesign.com] > Sent: 09 February 2003 20:52 > > Here's the deal: > > Let's say I have a form that requests the season schedule of > a baseball > team, and the team in question has twenty scheduled games all > on different > days. > > Each form row will have three select elements for the date; > i.e. date(x) for > the year, date(x+1) for the month, and date(x+2) for the day, > or however > I'll need to make each date select element unique. > > Then, in the insert page, I'll need to loop through each date > element by > groups of three and create an array for each date set. If I'm reading this right, you need to do something like this on your form page: <form ....> <?php for ($i=1; $i<=20; $i++): ?> <select name="date_year[<?php echo $i ?>]"> ... </select> <select name="date_month[<?php echo $i ?>]"> ... </select> ... <?php endfor; ?> </form> and then your receiving page will have arrays called $_POST['date_year'], $_POST['date_month'], etc (or the equivalent globals if you've chosen the insecure register_globals On route). 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 (#135044) next »