send form data to a separate PHP page
I am trying to figure out how to send data from a form, which will send X elements, to a PHP page so that, depending on the options chosen in the form, the appropriate data will be retrieved.
Here is the page, the form is on the left:
As you can see, you can change the number of instruments you send with the form.
The PHP code will then have to be something like:
$data = mysql_query("SELECT * FROM works WHERE (instrumentation = menuselection1 AND menuselection2 AND menuselection3 etc) ORDER BY composers, composed DESC")
Of course, the number of entries send must correspond to the number of elements in the column, so that when 'flute' is selected on its own, only pieces for solo flute are retrieved.
Is this clear?
Maaaaaaaaaaaany thanks for your help.
hmm I thought that this question would have been easy for you guys! :-)
Here's a suggestion:
You can use the mysql IN clause to search in the array:
// assuming you sanitize your POST variables...
$instruments = implode(",",$_POST['instruments']);
$sql = "SELECT * FROM `table` WHERE instruments IN ($instruments)";
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread