We want to dynamically create a form with content from a database using arrays. Extracting the data from the DB is easy:
$sql_inhalt = "SELECT * FROM tbl_inhalt ORDER BY id ASC";
$result_inhalt = mysql_query($sql_inhalt) or die("INHALT".mysql_error());
while($rs_inhalt = mysql_fetch_row($result_inhalt)){
$id[] = $rs_inhalt[0];
$text[] = $rs_inhalt[2];
}
But how do we apply this data to the form so that the $id and $text correspond ?:
<form id="form1" name="form1" method="post" action="..." >
<?php foreach($text as $out_text){
echo '<textarea name="'.$id.'" type="text" class="mceEditor" cols="85" rows="5" />'.$out_text.'</textarea>';
}?>
</form>
Many thanks in advance for any help!