我的页面中有以下结构page.php
:
<html>
<head>
<title>Page title</title>
<script src="jquery-2.0.3.js"></script>
<script type="text/javascript">
function search(value){
window.location.href="page.php?search=" + value;
}
</script>
</head>
<body>
<?php
if(!empty($_GET['search'])){
//SQL-statement with WHERE column LIKE $_GET['search']
} else {
//Other SQL-statement without WHERE column LIKE $_GET['search']
}
?>
<h1>Title</h1>
<input type="text" onKeyUp="search(this.value);"
value="<?php echo $_GET['search']; ?>">
</body>
</html>
正如您所读到的,重要的是,当spacebar
按下 a 时,它会_
在 the$_GET['search']
和 myinput
字段中放置一个&nsbp;