You are indeed correct in your assumption as to the line which causes the problems.
Replace the line $myarray[$i]= $myvar.$i; with $myarray[$i] = ${"myvar".$i}; It should solve your problems. You might want to do an isset(${"myvar".$i}) and an !empty(${"myvar".$i}) check before assigning them however, in case you only get $myvar1, $myvar3, $myvar4 etc. Always program defensively, it saves hassle in the long run. Hope that helps Ross > -----Original Message----- > From: crizz [mailto:[EMAIL PROTECTED]] > Sent: 25 August 2002 17:21 > To: [EMAIL PROTECTED] > Subject: [PHP-WIN] array way.... > > > Can you helpme with that? > I have some variables with names like: $myvar1, $myvar2, $myvar3... and so > on... and I want to put them in an array. Ofcourse I need a Loop because I > don't know the number of the variables. > It will probably be like that: > > $myarray= range(1,NumberOfVars); > $i=1 > while ($ i <= NumberOfvars) { > $myarray[$i]= $myvar.$i; # <----here is the problem right? > } > > To be honest, the $myvar1... variables come with "post" method from a form > and because I don't know how to send the directly as arrays I > need this. So > if someone knows how to send them directly from the form as arrays (if > possible) it would be great > > thanks for advance, > just started with php, crizz :D > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php