I have searched for this one for ages before resorting to ask for help!
I have two tables
Members and Categories
I want members to insert their data into table.members and up to 4 categories into table.categories
I have no problem with the first insert. The second insert though always show the last category. ie. If member types math, physics, chemistry, here is what I get
Name of member, chemistry
Name of member, chemistry
Here is the code:
$table = "categories";
$sql = "SELECT id, user FROM $mysql_cat WHERE user = '$user'";
$result = mysql_query($sql);
while ( $row = mysql_fetch_array( $result ) ) {
$user = $row["user"];
$category = $row["category"];
$table = "categories";
mysql_query("INSERT INTO $table (id, user, category) VALUES ('','$user', '$category')");
}
?>
<form action=add-multiple.php?l=<?php echo $l; ?>&page=add method=post enctype="multipart/form-data"><center>
<div align="center"> </div>
<Table width=719 Border="1" align="center" CellPadding="4" CellSpacing="0" bordercolor=black bgcolor=<?php echo $color3; ?>>
</tr>
<td><input class=input type=text name=category></td>
</tr>
</tr>
<td><input class=input type=text name=category></td>
</tr>
<input class=input type=submit value="Submit">
</table>
</form>


