Hello Coders!
I'm working on a project where I want to send multiple selected data from a form to be stored in a MySQL table. I havn't figured out how to make the PHP coding so MySQL will store it in a way that later will make it possible to retrieve the data according to search criteria WHERE I only want one of the multiple selections to be the key for what's being SELECTed from the table.
I suppose I would need to use Multiple Arrays here, but I don't get it how I construct the form to post it in the right way into MySQL.
The following pieces of HTML and PHP is what I've come up with so far, but this will only add ONE value to the table column "Categories":
<B>Konstnärskategorier:</B><BR>
<INPUT name="kategorier" type="radio" value="malare"
<? if ($kategorier == malare) {
echo "checked";
} ?>
<INPUT name="kategorier" type="radio" value="skulptor"
<? if ($kategorier == skulptor) {
echo "checked";
} ?>
<INPUT name="kategorier" type="radio" value="grafiker"
<? if ($kategorier == grafiker) {
echo "checked";
} ?>
<INPUT name="kategorier" type="radio" value="konsthantverkare"
<? if ($kategorier == konsthantverkare) {
echo "checked";
} ?>
<INPUT name="kategorier" type="radio" value="fotograf"
<? if ($kategorier == fotograf) {
echo "checked";
} ?>
Say, that I'm an artist working as "painter", "sculptor" and "photographer" and I want all three values to be stored in the table. Now, if someone i searching for "sculptors", I want the PHP script to SELECT only those artists that have "sculptor" as one of its artistic fields of work.
I've looked through several books on both PHP and MySQL and I havn't found this problem being described anywhere (or rather its solution).
Does anyone have a tip for how I can can move on - or a hint on where I can read about the problem?
Lars