Hi!
I have a problem with a dynamically generated form. What I do, is I extract information from a database, and display all the information in a form - the number of row depending on the number of rows in the database.
The following code generates each row in the table:
while($row=mysql_fetch_array($result))
{
echo "<TR BGCOLOR='#FFF3D5'>";
echo "<INPUT TYPE='HIDDEN' NAME='idno' VALUE='$row[id_no]'>";
echo "<TD><INPUT CLASS='formp' TYPE='TEXT' NAME='namn' SIZE='25' VALUE='$row[namn]'>";
echo "</TD>";
echo "<TD><INPUT CLASS='form' TYPE='TEXT' NAME='placering' SIZE='30' VALUE='$row[placering]'>";
echo "</TD>";
echo "<TD><INPUT CLASS='form' TYPE='TEXT' NAME='placeringNasta' SIZE='30' VALUE='$row[placering_nasta]'>";
echo "</TD>";
echo "<TD><INPUT CLASS='formpc' TYPE='TEXT' NAME='anknytning' SIZE='4' VALUE='$row[anknytning]'>";
echo "</TD>";
echo "<TD><INPUT CLASS='formpc' TYPE='TEXT' NAME='mobil' SIZE='15' VALUE='$row[mobil]'>";
echo "</TD>";
echo "<TD><INPUT CLASS='form' TYPE='TEXT' NAME='ovrigt' SIZE='25' VALUE='$row[ovrigt]'>";
echo "</TD>";
echo "</TR>";
}
As you can see, the code will generate duplicate names for the form elements. My initial thought was that, like in ASP, arrays would be created holding all the values. However, it seems that instead the variables are overwritten, and in the resulting page only the last row of the table will be preserved.
Is there an easy way to get around this problem? Or will I have to create index numbers manually?
Any help would be much appreciated...