zakula11
Jun 25th 2006, 3:51 pm
I have two select boxes. I need so that: when an option on one select box is selected, PHP opens a file (based on the value of the option selected). The information inside the file needs to be read and used to create options in the second select box.
I believe I know how to read the file and then possibly echo the options (if the php code is inside a javascript function), but the problem is that the filename is based on the selected option in the first select box. I'm not sure how to pass the value of that variable into the php code, so that PHP knows what file to open. Submitting a form is not an option because then it redirects the page.
To make this easier to understand, here is the actual page I am dealing with: http://uglyduck.homeip.net/musicTest.php
There is a select box of saved playlists. The names of the playlists are the same names as the filenames. In the file, each line contains a filename to a song. I want so that when you select a playlist and click "Load", that it will create an option for each listed song in the "current playlist" select box.
I have been suggested to use XMLHttpRequest from another forum. I have tried this but can't seem to be able to get it to work. If this is the correct way to do this, helping me with this exact case or similar code examples would be nice.
Thanks to anyone that can help me with this issue.
I believe I know how to read the file and then possibly echo the options (if the php code is inside a javascript function), but the problem is that the filename is based on the selected option in the first select box. I'm not sure how to pass the value of that variable into the php code, so that PHP knows what file to open. Submitting a form is not an option because then it redirects the page.
To make this easier to understand, here is the actual page I am dealing with: http://uglyduck.homeip.net/musicTest.php
There is a select box of saved playlists. The names of the playlists are the same names as the filenames. In the file, each line contains a filename to a song. I want so that when you select a playlist and click "Load", that it will create an option for each listed song in the "current playlist" select box.
I have been suggested to use XMLHttpRequest from another forum. I have tried this but can't seem to be able to get it to work. If this is the correct way to do this, helping me with this exact case or similar code examples would be nice.
Thanks to anyone that can help me with this issue.