RE: [PHP] here's a tricky one (well for me)

2001-03-06 Thread Boget, Chris

  I am trying to let a user build a form, so on the first page they 
 decide on the number of fields , when they submit that number 
 it names them field1 2 3 etc,now I then want them to name the
 fields but the problem is because the number of fields varies how 
 do I pass all the variables onto the next page if one time it could 
 be 2 next time it could be 10

On the first page, the field name that specifies the number of fields
is "number_of_fields".
On the second page that takes that value and works with it, you can
do something like this:

for( $i = 1; $i = $number_of_fields; $i++ ) {
  $fieldName = "field$i";
  echo "input type=text name=\"$fieldName\"
value=\"${$fieldName}\"br\n";

}echo "input type=hidden name=\"number_of_fields\"
value=\"$number_of_fields\"\n";

When processing your form to get the values, do essentially the same
thing:

for( $i = 1; $i = $number_of_fields; $i++ ) {
  $fieldName = "field$i";
  echo "The value entered for field $i is ${$fieldName}br\n";

}

Through all your forms, just work with "$number_of_fields".

Chris



Re: [PHP] here's a tricky one (well for me)

2001-03-06 Thread george


Thanks Chris

george



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]