Jump to content

Advanced Search Form


harkly

Recommended Posts

I want to use a somewhat advanced search form but I can't find anything online to help me figure out how to pull the values and pass the variable.

 

If someone selects "Movements" I want a query done on that database but I can't figure out how to pass that value to search.php

 

<form name="search" method="post" action="search.php">

Seach 

<select NAME="field">

<option value="all">All</option>

<option value="artist">Artists</option>

<option value="artwork">Art Works</option>

<option value="medium">Mediums</option>

<option value="movement">Movements</option>

<option value="genre">Genres</option>

<option value="museum">Museums</option>

<option value="period">Periods</option>

</Select>

for <input type="text" name="find" />

<input type="hidden" name="search" value="yes" />

<input type="submit" name="search" value="search" />

</form>

Link to comment
https://forums.phpfreaks.com/topic/131987-advanced-search-form/
Share on other sites

is movements a database or table? for a table

//some code to connect to DB
$table = mysql_real_escape_string($_POST['field']);
$search = mysql_real_escape_string($_POST['find']);
$query = "SELECT * FROM `{$table}` WHERE `search_field` LIKE (\"%{$search}%\")";
//some code to do the query and display the results

 

Scott.

Link to comment
https://forums.phpfreaks.com/topic/131987-advanced-search-form/#findComment-685823
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.