With much help and lots of searching I've been able to bring together the code below. It consists of two PHP files and one text file. MUSICLIST.PHP reads the text file and displays a table for the viewer where they can select songs by checking the associated box. Then they click submit and the selected songs are displayed and a list is emailed to me.
The *problem* is that it works when less that about 45-50 songs are selected - there are over 900 in the text file. Any more than that and the Submit button seems to quit working - click it and nothing happens. I know I should probably be using MySQL or something, but a)that's out of my range and b) there is no db available on the hosting site...
Any help in getting this to work would be greatly appreciated. Thanks in advance!
The *problem* is that it works when less that about 45-50 songs are selected - there are over 900 in the text file. Any more than that and the Submit button seems to quit working - click it and nothing happens. I know I should probably be using MySQL or something, but a)that's out of my range and b) there is no db available on the hosting site...
Any help in getting this to work would be greatly appreciated. Thanks in advance!
Code:
[b]MUSICLIST.PHP[/b]
<html>
<body>
<form action="musicsend.php">
<table border="1">
<tr><th>I want it</th><th>Title</th><th>Artist</th></tr>
<?php
$FIL=fopen("music.txt","r");
while ($lin=fgetcsv($FIL,100000,",")) {
echo "<tr><td><input type=\"checkbox\" name=\"nr[]\" value=\"$lin[0]\"></td><td>$lin[0]</td><td>$lin[1]</td></tr>\n";
}
fclose($FIL);
?>
</table>
<input type="submit" value="Send selection list">
</form>
</body>
</html>
[b]MUSICSEND.PHP[/b]
<html>
<body>
<?php
$lis=$_GET[nr];
$mess="Prepare the following files : ";
echo "You sent a list of ",count($lis)," melodies :<br>\n";
if ($lis) {
echo "<ol>\n";
$FIL=fopen("music.txt","r");
while ($lin=fgetcsv($FIL,10000000,",")) if (array_search($lin[0],$lis)!==false) {
echo "<li>$lin[0] - $lin[1]</li>\n";
$mess.="\n$lin[0],$lin[1],$lin[2],$lin[3]";
}
fclose($FIL);
echo "</ol>\n";
mail("email@yourdomain.com","Playlist requirement:",$mess);
}
?>
</body>
</html>
[b]MUSIC.TXT[/b] (this is just a sample list)
1999,PRINCE,CD title,Track #
#1 (RADIO EDIT),NELLY,CD title,Track #
(SITTIN' ON) THE DOCK OF THE BAY,OTIS REDDING,CD title,Track #
'03 BONNIE & CLYDE,"JAY-Z, BEYONCE",CD title,Track #
100 YEARS,FIVE FOR FIGHTING,CD title,Track #
100 PURE LOVE,CRYSTAL WATERS,CD title,Track #
19 SOMETHIN ',MARK WILLS,CD title,Track #
A MOMENT Like THIS,KELLY CLARKSON,CD title,Track #
A PIRATE LOOKS AT FORTY,JIMMY BUFFETT,CD title,Track #
A PROMISE OF LOVE (INSTRUMENTAL),JOHN TESH,CD title,Track #
A SORTA FAIRYTALE,TORI AMOS,CD title,Track #
A THOUSAND MILES,VANESSA CARLTON,CD title,Track #
A WOMAN 'S WORTH,ALICIA KEYS,CD title,Track #