hi
i have got a form which looks like this:

<form action="<?php echo $_SERVER['php_self];?>" method="post">
<input type="checkbox" name="flight[]" value="kingfisher" />
<input type="checkbox" name="flight[]" value="Spicejet" />
<input type="checkbox" name="flight[]" value="AirIndia" />
</form>

i need to generate a query which would select data based on the result of this form.
for instance if the user were to select kingfisher and airindia then all the rows containing `company_name` as kingfisher OR airindia should be selected. it seems like i need to generate a dynamic query or something..
thanks in advance.

you can build your query as shown below

$query= " select * from mytable where 
company_name in ( '".implode("','",$_POST['flight'])."' )";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.