I have a form that looks something like this:

<input name="company" value="company1" />
<input name="company" value="company2" />
<input name="company" value="company3" />

I need to come up with a way to search a mysql table based off what checkboxes a user checks. Keep in mind there can be multiple companies selected.

For example

SELECT * FROM Companies WHERE CompanyName = $companies

My issue is I don't know how to combine the post array of company names to correctly query it.

Any help would be appreciated, thanks!

Member Avatar

It should be soemthing like this:

if(isset($_POST['submit']) && !empty($_POST['submit']))
            $query="select * from company where name='$cname'";
                while($row = mysql_fetch_array($result))
                    echo "Company Names <br>";
                    echo $row['name'];