I am trying to create a dynamic select query based on a list of form elements submitted from the previous screen.
What i wold like to do is loop through the submitted fields and compare them to the fields in a db table with the same names. I can easily get the values from the fields, but i cannot find the function or variable to get the array of form field names.
Can anyone point me in the right direction?
Thanks!
Form field info after a post
Moderator: General Moderators
-
styrmstread
- Forum Newbie
- Posts: 4
- Joined: Mon Sep 29, 2003 11:09 am
if i understand you correctly, here is what you can do,
if the form is submitted by the POST method use the following to loop through these form fields.
In this case $var is the formfield name, and $val is the value associated with this field.
Once in this loop you can check names using something like
ereg checks $var to see if nnn are the first three characters of its value.
you can then perform your process conditionally dependent upon which form field $var is pointing to.
I hope this makes sense...let me know if you don't understand.
Styrmstread
if the form is submitted by the POST method use the following to loop through these form fields.
Code: Select all
while (list($var,$val) = each($HTTP_POST_VARS))
{ ....}Once in this loop you can check names using something like
Code: Select all
if (ereg("^nnn",$var,$throwaway))
{
....
}you can then perform your process conditionally dependent upon which form field $var is pointing to.
I hope this makes sense...let me know if you don't understand.
Styrmstread