RE: [PHP-GENERAL] Newbie help: Need code snippet ASAP

From: Date: Wed, 07 Jun 2000 19:13:19 +0000
Subject: RE: [PHP-GENERAL] Newbie help: Need code snippet ASAP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-1245@lists.php.net to get a copy of this message
> Anyway, the code for that suggestion would simply be a for loop that spits > out the number of for fields desired. $fieldCount reflects how many > groupings of Lines 1 to 3 they want. > > for( $i = 0; $i < $fieldCount; $i++ ) > { ?> > Line1: <input type="text" name="line1[]"><br> > Line2: <input type="text" name="line2[]"><br> > Line3: <input type="text" name="line3[]"><br> > <? } > > Which will make three arrays of fields. So your first grouping would be > $line1[0], $line2[0], $line3[0], the second $line1[1], $line2[1], > $line3[1], and so on. This code snippet provided by Matt McClanahan gave me a boost in the right direction. After some searching and four days worth of testing, checking, cursing, coding, and retesting, I have successfully accomplished my task. While the form doesn't automatically update itself, I was able to make use of the named Submit button in HTML and use the isset() function in PHP to allow the user to enter some information, click and "Add More Lines" button and have the form regenerate itself, displaying the information already entered and adding a new set of lines for the user to continue entering data. Once the user is done, they click the submit button which sends out an email containing the information entered. I'm sure the coding is not as efficient as it could be, but it seems to work. If anyone is interested in the finished product, I would be happy to send a stripped down copy (have to remove the confidential info) to anyone who requests it. Yet another example of the wonderful things that can happen when users help users. Thanks to all who offered suggestions. Dion ************************************************************************* * Dion Vansevenant * * Systems & Technology Analyst dion.vansevenant@rowecom.ca * * RoweCom Canada Tel: (519) 472-1005 * * P.O. Box 2382 Fax: (519) 472-1072 * * London, ON N6A 5A7 www.rowecom.ca * * Canada * *************************************************************************

« previous php.general (#1245) next »