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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.