I need to insert x amount of rows from one form. The form displays x
amount of rows. I then need to insert the values from the form x amount
of times. The form loop works fine but how do I INSERT x amount of
times within a loop from the values of the form? I think I need to use
some sort of array. I suck at arrays.
This executes when submit is hit:
$i = 1;
while ($i <= $songsinalbum) {
$query = "INSERT INTO songs VALUES ('$id',
'$songname','$rating','$video', '$album_id', '$movie')";
$result = mysql_db_query("movies", $query);
};
Here is form:
<form enctype="multipart/form-data" method="post"
action="<?php echo $PHP_SELF ?>">
<?
$i = 1;
while ($i <= $songsinalbum) {
?>
<TR>
<TD align="right">ID: </TD><TD><input type=text name=id value=<? echo
$i; ?> size=3><br></TD>
<TD align="right">Songname: </TD><TD><input type=text name='songname'
size=30><br></TD>
<TD align="right">Rating: </TD><TD><input type=text name='rating'
value='***' size=5 maxsize=5><br></TD>
<TD align="right">Video ID: </TD><TD><input type=text name='video'
size=2 maxsize=3><br></TD>
<TD align="right">Album ID: </TD><TD><input type=text name='album_id'
value=<? echo $id; ?> size=2 maxsize=3><br></TD>
<TD align="right">Movie ID: </TD><TD><input type=text name='movie'
size=2 maxsize=3><br></TD></TR>
<?
$i++;
};
?>
<input type="submit" name="submit" value="Upload">
</form>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php