Re: PHP Forms
| From: | Chris | Date: | Fri, 05 May 2006 03:04:34 +0000 |
| Subject: | Re: PHP Forms | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235608@lists.php.net to get a copy of this message | ||
R. Van Tassel wrote:
I am having an issue with a form, basically an order form, with 10 rows. Each row is the same, the rows are being generated by a loop and I am appending the counter of the loop to the name of the form elements (i.e. quantity1, type1, next row = quantity2, type2, etc) I can't seem to receive the variables without using sessions, which I'm trying not to do. If only the first 2 rows are being filled out and submitted I need to be able to loop through, grab all the variables and print them out. Can anyone give any suggestion?Make them an array: <input type="text" name="quantity[1]" value="X"> <input type="text" name="quantity[2]" value="X"> etc etc. Then when you post you get an array of quantities which you can loop through: foreach($_POST['quantity'] as $p => $value) { if (empty($value)) continue; // they didn't fill this field in. .... } -- Postgresql & php tutorials http://www.designmagick.com/