我在创建网站时面临一个问题。我的网站上有一个搜索栏。我试图用中文输入和搜索,但我输入的页面上的搜索词变成了问号和符号。url也相同。我想知道怎样才能使它起作用。只有搜索词会变成这样。有什么解决方案吗?
Updated:这是我的搜索表单(这是一个适用于我的多站点的搜索框)。
<div class="search">
<form name="searchform" onsubmit="return !!(validateSearch() && dosearch());" method="get" id="searchform">
<input type="text" name="searchterms" class="terms" id="terms" placeholder="<?php if (is_search()) { ?><?php the_search_query(); ?><?php } elseif (is_home() || is_single() || is_page() || is_archive() || is_404()) { ?>What are you searching for?<?php } ?>">
<select name="sengines" class="state" id="state">
<option value="" selected>Select a State</option>
<?php $bcount = get_blog_count();
global $wpdb;
$blogs = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE spam = \'0\' AND deleted = \'0\' and archived = \'0\' and public=\'1\'"));
if(!empty($blogs)){
?><?php
foreach($blogs as $blog){
$details = get_blog_details($blog->blog_id);
if($details != false){
$addr = $details->siteurl;
$name = $details->blogname;
if(!(($blog->blog_id == 1)&&($show_main != 1))){
?>
<option value="<?php echo $addr; ?>?s="><?php echo $name;?></option>
<?php
}
}
}
?><?php } ?>
</select>
<input name="Search" type="submit" value="Search" class="button3">
</form>
</div><!--search-->
Javascript for the search form
function dosearch() {
var sf=document.searchform;
var submitto = sf.sengines.options[sf.sengines.selectedIndex].value + escape(sf.searchterms.value);
window.location.href = submitto;
return false;
}
function validateSearch(){
// set some vars
var terms = document.getElementById(\'terms\');
var state = document.getElementById(\'state\');
var msg = \'\';
if(terms.value == \'\'){
msg+= \'We were unable to search without a keyword! \\n\';
}
else if(terms.value.length < 3){
msg+= \'Keyword is too short! \\n\';
}
else if(terms.value.length > 25){
msg+= \'Keyword is too long! \\n\';
}
else if(state.value == \'\'){
msg+= \'Select state to proceed! \\n\';
}
// SUbmit form part
if(msg == \'\'){
return true;
}else{
alert(msg);
return false;
}
}