Accessing variables from a form

From: Date: Wed, 21 Feb 2001 16:43:51 +0000
Subject: Accessing variables from a form
Groups: php.general 
Request: Send a blank email to php-general+get-40994@lists.php.net to get a copy of this message
Hi, I'm in a quandary here. I have a form which contains sever tables each containing similar fields. The number of tables are dynamic based on vales I retrieve from a database. Each table has the following fields: $name $phone $fax In order to differentiate the filed names in my form, I created a loop and extended each field name with the loop iteration as such ($rownum is my loop counter): <snip> <input type="text" name="name" . $rownum . ">" <input type="text" name="phone" . $rownum . ">" <input type="text" name="fax" . $rownum . ">" So I would have field variables of: $name1, $name2, $name3, ... $phone1, $phone2, $phone3, ... $fax1, $fax2, $fax3, ... So far so good as I have verified that these fields exist. Now, when the user clicks on the submit button, the form data gets posted to a PHP script. I wish to access the variables but here I am at a loss. I attempted the following code without success ($rownum is the number of tables I created): for ($i = 1; $i <= $rownum; $i++) { $field = "phone" . $i; $name =& $field; echo $field . ":" . $name . "\n"; } The docs state that references are NOT pointers. So....., how can I access my variables? I could not find any information on Macros or Pointers. Thanks, Don

« previous php.general (#40994) next »