ok here we are, your code is *almost* correct, but even syntaxialy correct
doesnt mean it should be used :) use arrays, its a tone easier. to fix your
code change

$name =& $field;

to

$name = $$field;

now to make the code, a ton easier to use, use arrays.

<?php
...

 echo "
 <input type=text name=name[$people_id] value='somedata'>
 ";

...
?>

<?php
...

 foreach($name as $pos => $val)
 {
  echo $val;
 }

...
?>

arrays are great things, use them lost :) haha


--


Chris Lee
Mediawaveonline.com

em. [EMAIL PROTECTED]

ph. 250.377.1095
ph. 250.376.2690
fx. 250.554.1120



"Don" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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
>
>
>
>
> --
> 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]
>



-- 
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]

Reply via email to