recycling form or something like that


#1

um… if i kne what i want i would do that alredy i think, but heres waht im trying to get:

input field, presse submit, the data u’ve entred gos to new generated field (so now we have 2 fielsd one is with entered data, and enother where enter neww data) proses repets unlimeted number of times and store info in fields / variebles under file_$i patern…

seas easy, but im geting something somwhere wrong in theory…

here is the script that i’m playing with :

<?
// Handling On Submit
if(isset($submit)){
	if(!isset($g)){$g='0';}
	$g++; 
	echo "Sibmited $g: ${'file_'.$g}<br>";	
	  
}
?>
<form name="xxx" action="<? echo $PHP_SELF;?>" method="post">
<input type="text" name="file_<? echo $g;?>" size="40" maxlength="256">
<input type="submit" value="Submit" name="submit">
<input type="hidden" name="g" value="<? echo $g;?>"><br>
<?
//works but strangely
for ($i = 0; $i <= $g; $i++) {
  echo "$i - Part<br>";
  // echo $i .'- <input type=text name=file_$i size=40 maxlength=256 disabled value='. ${"file_".$i}.'><br>';
} 



//this is wrong
$z=0;
while(isset($g)){
   echo "Part $z<br>";
   $z++;
}
?>
</form>

Apreciate your help