I don't really understand Arrays and how they're used. I've read a lot of articles about them in books and online, but I still don't really get it.
I'm trying to insert multiple rows into a database based on if the forms are filled out.
here is where the empty forms are displayed:
if ($_GET[tracklist] && $_GET[mode] == "add") {
$display_block = " <table border='0' cellpadding='2' cellspacing='0'>
<form action='$_SERVER[PHP_SELF]' method='post'>
<tr>
<td width='25'><strong>#</strong></td>
<td><strong>Song Title</strong></td>
<td><strong>Mp3</strong></td>
</tr>";
for ($i = 1; $i <= 30; $i++) {
$display_block .= " <tr>
<td><strong>$i</strong></td>
<td><input type='text' name='song[]' size='50'></td>
<td><input type='text' name='file[]' size='35'></td>
</tr>";
}
$display_block .= " <tr>
<td colspan='3' align='right'><input type='hidden' name='op' value='add_trk'><input type='submit' name='submit' value='Submit'></td>
</tr>
</form>
</table>";
}
... and I don't really understand how to input them into the database.. run a for loop and if there is data in the forms, insert it? I've tried that but I can't seem to get it to work.
If someone could give me an example of the code i might use to check for the entry, and insert the data... I'd appreciate it.
Also, if someone could maybe explain a little more about arrays so I might be able to understand them more that would be fantastic. Thanks.