"Christopher M. Jones" <cjones12@tulane.edu> writes:
> I am just learning some php to make a web application. I have hit upon
> what is (to me) an insuperable problem. I need to create a form page
> that presents a variable number of inputs. The php needs to iterate
> through this variable number of form inputs to store the data into a
> database.
>
> For example, a list of students is presented (size of class varies)
> along with entry fields for grades. Hit a button at the bottom of the
> page and all entered grades are stored.
>
> The problem I have is how to iterate the name of the variable from the
> <input name=<varname>> tag. Does this make sense? I have been unable
> to find example code that does what I want. Maybe someone could at
> least point me in the right direction?
php populates array $_GET or $_POST depending on the form type
you use.
foreach ($_GET as $varname) {
//do something
}
OR
foreach ($_GET as $key => $value {
echo "$key => $value"
}
also see for loop documenation and docs for the each() function
on php.net
-- Scott Harney<scotth@scottharney.com> "...and one script to rule them all." gpg key fingerprint=7125 0BD3 8EC4 08D7 321D CEE9 F024 7DA6 0BC7 94E5 ___________________ Nolug mailing list nolug@nolug.orgReceived on 08/26/03
This archive was generated by hypermail 2.2.0 : 12/19/08 EST