Ho questo script della funzione di ricerca ( che fa parte di un blog opensource, di quelli senza database).

Vorrei modificarlo.

Vorrei fare in modo che anzichè avere un campo vuoto per la ricerca avesse un menù a tendina con 4 o + scelte preimpostate.



Codice PHP:
<?php 

    
// ----------------
    // Search Functions
    // ----------------
    
    
function search $search_str$max_results=10 ) {
        
// Search in contents feature a list of keywords separated by spaces
    
        // Read entries by month, year and/or day. Generate HTML output.
        //
        // Used for the main Index page.
        
global $lang_string$blog_config$user_colors;
        
        
// To avoid server overload
        
sleep(1);
        
        
$output_str '';
        
        
$entry_file_array blog_entry_listing();

        
$words=@split' 'strtoupper$search_str ) );
        
        if ( 
strlen$search_str ) > 1) {
            for ( 
$i 0$i count$words ); $i++) {
                
$words[$i] = trim($words[$i] );
            }
            
            if ( 
$max_results <= ) {
                
$max_results=10;
            }
            
            
$results=0;
            
// Loop through entry files
            
for ( $i 0$i count$entry_file_array ); $i++ ) {
                if ( 
$results $max_results ) {
                    break;
                }
            
                list( 
$entry_filename$year_dir$month_dir ) = explode'|'$entry_file_array$i ] );
                
$contents sb_read_fileCONTENT_DIR $year_dir '/' $month_dir '/' $entry_filename );
                
$j 0;
                
$found true;
                
$text strtoupper$contents );
                while ( ( 
$j<count$words ) ) && ( $found ) ) {
                    if ( 
$words[$j] !== '' ) {
                        
$found $found && ( strpos$text$words[$j] ) !== false );
                    }
                    
$j++;
                }
                if ( 
$found ) {
                    
$results++;
                    
$blog_entry_data blog_entry_to_arrayCONTENT_DIR $year_dir '/' $month_dir '/' $entry_filename );
                    
$output_str  .= '[url="index.php?entry=' sb_strip_extension$entry_filename ) . '"]' $blog_entry_data'SUBJECT' ] . '[/url]
'
;
                }
                
// Search Comments
                
if ( $blog_config'blog_enable_comments' ] == true ) {
                    
$comment_file_array sb_folder_listingCONTENT_DIR $year_dir '/' $month_dir '/' sb_strip_extension$entry_filename ) . '/comments/', array( '.txt''.gz' ) );
     
                    for ( 
$k 0$k count$comment_file_array ); $k++ ) {
                        
$comment_filename =  $comment_file_array$k ];
                        
//We only want to search inside comments, not the counter
                        
if ( strpos($comment_filename'comment') === )
                        {
                            
$contents_comment sb_read_fileCONTENT_DIR $year_dir '/' $month_dir '/' sb_strip_extension$entry_filename ) . '/comments/' $comment_filename );
                            
$found_in_comment true;
                            
$l 0;
                            
$text strtoupper$contents_comment );
                            while ( ( 
$lcount$words ) ) && ( $found_in_comment ) ) {
                                if ( 
$words[$l] !== '' ) {
                                    
$found_in_comment $found_in_comment && ( strpos$text$words[$l] ) !== false );
                                }
                                
$l++;
                            }
                            if ( 
$found_in_comment ) {
                                
$results++;
                                if ( 
$found == false ) {
                                    
// list( $blog_subject, $blog_date, $blog_text ) = explode('|', ( $contents ) );
                                    
$blog_entry_data blog_entry_to_arrayCONTENT_DIR $year_dir '/' $month_dir '/' $entry_filename );
                                    
$output_str  .= $blog_entry_data'SUBJECT' ] . '
'
;
                                }
                                
                                
// list( $comment_author, $comment_date, $comment_text ) = explode('|', ( $contents_comment ) );
                                
$comment_entry_data comment_to_arrayCONTENT_DIR $year_dir '/' $month_dir '/' sb_strip_extension$entry_filename ) . '/comments/' $comment_filename );

                                global 
$theme_vars;
                                if ( 
$blog_config'blog_comments_popup' ] == ) {
                                    
$output_str  .= '[url="javascript:openpopup(\'comments.php?y='.$year_dir.'&amp;m='.$month_dir.'&amp;entry='sb_strip_extension($entry_filename).'\','.$theme_vars'popup_window' ][ 'width' ].','.$theme_vars'popup_window' ][ 'height' ].',true)"]' $comment_entry_data'NAME' ] . '[/url]
'
;
                                } else {
                                    
$output_str  .= '[url="comments.php?y=' $year_dir '&amp;m=' $month_dir '&amp;entry=' sb_strip_extension$entry_filename ) . '"]' $comment_entry_data'NAME' ] . '[/url]
'
;
                                }
                            }
                        }
                    }
                }
            }
            
// Search static pages
            
$static_file_array sb_folder_listingCONTENT_DIR.'static/', array( '.txt''.gz' ) );
            for ( 
$i 0$i count$static_file_array ); $i++ ) {
                
$static_filename =  $static_file_array$i ];
                
$contents_static sb_read_fileCONTENT_DIR.'static/' $static_filename );
                
$found_in_static true;
                
$j 0;
                
$text strtoupper$contents_static );
                while ( ( 
$jcount$words ) ) && ( $found_in_static ) ) {
                    if ( 
$words[$j] !== '' ) {
                        
$found_in_static $found_in_static && ( strpos$text$words[$j] ) !== false );
                    }
                    
$j++;
                }
                if ( 
$found_in_static ) {
                    
$results++;
                    
$blog_static_data static_entry_to_arrayCONTENT_DIR.'static/' $static_filename );
                    
$output_str  .= '[url="static.php?page=' sb_strip_extension$static_filename ) . '"]' $blog_static_data'SUBJECT' ] . '[/url]
'
;
                }
            }
        }
        return ( 
$output_str );
    }
?>