Hi All,
I really would like some help on this as I’m pulling hair out!!!
I have two fields, one being an input box & the other being a drop down list which search the database and display the results, however I cannot seem to figure it out…here is what I have so far…
This is the actual search form:
<form id="myform" name="myform" action="<?php echo $_SERVER['PHP_SELF']?>" method="get"><br />
<div class="T1"><br /><p></div> <input name="term" type="text" value="<?php echo $_GET['searched']; ?>" size="10" maxlength="4" placeholder="e.g. BS1"/>
<select>
<option value="">I feel like...</option>
<option value="">Anything</option>
<option value="Indian">Indian</option>
<option value="Chinese">Chinese</option>
<option value="Thai">Thai</option>
</select>
<input type="submit" name="submit" value="Go"/>
</form>
And this is the PHP code:
[php]
<?php if (isset($_GET['submit'])){ mysql_connect ("host", "user","password") or die (mysql_error()); mysql_select_db ("database"); $term = $_GET['term']; $term = $_GET['option value']; } else $sql = mysql_query("select pagetitle from Restaurant where extra like '%$term%' and showing like '1'"); $sql = mysql_query("select cuisine from Restaurant where cuisine like 'option value' and showing like '1'"); echo Restaurants in $term and Cuisine $option value:"; } while ($row = @mysql_fetch_array($sql)){ echo ''.$row['pagetitle']; echo ''; } } ?>
[/php]
The database has a table called Restaurant with two coloumns, one called ‘Extra’ which contains the postcode & the other called ‘Cuisine’ which containts the cuisine.
I would like it to return a list of restaurants that match both ‘Extra’ and ‘Cuisine’
Any help will be greatly appretiated.