So I've been developing a personal website that utilizes PHP and a MySQL database to generate randomized playlists for users and play the songs (located on my server) in a JW Flash Player. After doing lots of localhost debugging, I got it pretty much working. I decided to reformat an old PC and put Centos on it (even though I've have little Linux Kernel experience) and run that as my webserver. Now that I've moved everything to my server, it doesn't behave like it did when running on a WAMP setup. Essentially what's supposed to happen is the user makes a bunch of selections from a list of available checkboxes, and then when they click submit an xml playlist is supposed to be generated, and then the page with the flash player embedded looks for that playlist and begins playback. For some reason, when I access the site on my laptop @ home, everything works perfectly. When I try it on other computers (say, at a friend's house) it doesn't. After running firebug, I noticed that only when: (1) I step through the buildPlaylist() method or (2) add something like an alert() statement in that method does the playlist actually get built on these other computers. Otherwise, it just fails to build the playlist. I'm thinking that there's something wrong with my code...so that's why I came here. Here is the code of interest.
So here's the html code for the submit button:
Code: Select all
<form id='myform' action='submt.php' onsubmit='return buildPlaylist();'>
<input type="submit" name="Submit" value="Submit" >
</form>
And here's the code for the buildPlaylist() method:
Code: Select all
function buildPlaylist() {
/* This is going to build the xml file and take you to the next page */
if (songs.length == 0 && favorites.length == 0) {
alert("You haven't selected any songs!");
return false;
}
else {
var phpString = "";
for (var i = 0; i < songs.length; i++) {
phpString = phpString + "&song[]=" + songs[i];
}
for (var i = 0; i < favorites.length; i++) {
phpString = phpString + "&fav[]=" + favorites[i];
}
var dummyimage = new Image();
if (document.getElementById('random').checked == true)
dummyimage.src = "build.php?" + phpString + '&numSongs=' + document.getElementById('numSongs').value;
else
dummyimage.src = "build.php?" + phpString;
return true;
}
}
-Mark