Jump to content

Search options


xamonix

Recommended Posts

Hi  I have this serach function, wich searches on site by a lot of parameters at the same time (titolo, titolo2, attore1,etc...) , but I want to make them options, so you would have a search field and an options dropdown menu.

 

Can anyone help me with this?

 

My code follows:

PHP

function jm_search(){
	global $database, $sstring, $my, $cinConfig, $Itemid, $option, $mainframe;	

	$tl_title = _JMOVIES_SEARCHRESULT." ".$sstring;

	$suchstring = trim( strtolower( $sstring ) );
	$query1   = "SELECT * FROM #__jmovies WHERE"
	."\n (titolo LIKE '%".$suchstring."%'"
	."\n OR titolo2 LIKE '%".$suchstring."%'"
	."\n OR attore1 LIKE '%".$suchstring."%'"
	."\n OR attore2 LIKE '%".$suchstring."%'"
	."\n OR attore3 LIKE '%".$suchstring."%'"
	."\n OR attore4 LIKE '%".$suchstring."%'"
	."\n OR nazione LIKE '%".$suchstring."%'"
	."\n OR regista LIKE '%".$suchstring."%'"
	."\n OR descrizione LIKE '%".$suchstring."%'"
	."\n OR anno LIKE '%".$suchstring."%') AND published = 1 AND access <= ".(int)$my->gid." ORDER BY titolo";
	$database->setQuery($query1);
	//echo $database->getQuery();
	$rows = $database->loadObjectList();

	if(is_file($mainframe->getCfg('absolute_path')."/components/".$option."/templates/".$cinConfig['template']."/show_search_tpl.php"))
		require($mainframe->getCfg('absolute_path')."/components/".$option."/templates/".$cinConfig['template']."/show_search_tpl.php");
	else
		require($mainframe->getCfg('absolute_path')."/components/".$option."/templates/default/show_search_tpl.php");

}

 

HTML

<td width="44%" valign="middle" bgcolor="#eeeeee" style="text-align:right">
      <input name="sstring" type="text" class="jmoviesInputSearch" title="<?php echo _JMOVIES_SEARCH?>" onfocus="if(this.value=='<?php echo _JMOVIES_SEARCH?>') this.value='';" onblur="if(this.value=='') this.value='<?php echo _JMOVIES_SEARCH?>';" onchange="javascript:document.jmoviesSearchForm.submit();" value="<?php echo _JMOVIES_SEARCH?>" size="50"/><input type="submit" value="OK" class="button"/></td>

 

Thank you.

Link to comment
https://forums.phpfreaks.com/topic/226561-search-options/
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.