Hi,
I have a web page that has a drop down list with multiple select. Based on the user's selections, mysql database has to be queried for each option selected by user.
The name of drop down list is EDUCATION. $lines counts the number of options selected. I am storing value of each option in $mystore[$i]
I am using loop as I need to query database for each option the user selects from the list. The code does not work. Any suggestions?
<?php
$lines = 0;
$i=0;
foreach ($_POST['EDUCATION'] as $EDUCATION => $value)
{
echo "Education: $EDUCATION; Value: $value<br>";
$store[$EDUCATION] = $value;
$mystore[$i] = $store[$EDUCATION];
$lines++;
}
$eduresult = SELECT FROM profile;
for($i=0;$i<$lines;$i++)
{
$edu = "SELECT FROM profile WHERE EDUCATION = '$mystore[$i]'";
$eduresult =mysql_query(".$eduresult.UNION.$edu.")or die(mysql_error());
}
while($row = mysql_fetch_array( $eduresult )) {
echo $row['NAME'];
echo $row['EMAIL'];
}
?>