开发者

MYSQL Search Question

开发者 https://www.devze.com 2023-03-25 06:00 出处:网络
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="text/html; charset=uft8_general_ci" http-equiv="Content-Type" />
<meta content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" name="viewport" />
<link href="css/style.css" rel="stylesheet" media="screen" type="text/css" />
<script src="javascript/functions.js" type="text/javascript"></script>
<title>Myhalal Check</title>
<meta content="keyword1,keyword2,keyword3" name="keywords" />
<meta content="Description of your page" name="description" />







</head>

<body class="list">

<div id="topbar"class="black">
<div id="title">
        <span style="color: #ff006f; ">my</span>hala<span style="color: #fff70a; ">check</span></div>
<div id="rightnav">
        <a href="About.html">About</a>

</div>
<div id ="leftnav">
<a href="Submit.html">Submit</a>
</div>
</div>
<div class="searchbox">
    <form action="Search.php" method="get">
        <fieldset><input name="search" id="search" placeholder="Search开发者_运维技巧 for a Product" type="text" />
        <input id="submit" type="hidden" name="search" /></fieldset>
    </form>

</div>
<div id="content">
<ul>        
<?php
$search = $_GET['search'];

$host = "x"; 
$user = "x"; 
$pass = "x"; 
$db = "x";

mysql_connect($host, $user, $pass); 
mysql_select_db($db); 
unset($host,$user,$pass,$db); 



//$query = "SELECT produkt FROM checklist WHERE id LIKE '1'";
$query = "SELECT produkt FROM checklist WHERE id LIKE '%$search%'";  
$result = mysql_query($query); 
  while ($row = mysql_fetch_array($result)) 
{ 

echo "<li><span class='name'><b>$row[produkt]";
  }  
?>
</ul>   
</div>
<div id="footer">You could <b><a href="Submit.html"><span style="text-decoration: "><span style="color: #ff006f; ">su</span>bm<span style="color: #fff70a; ">it</span>
</a>
 </b>more Products to help us.
    </div>

</body>

</html>

after wrong deleting my last question here is it again.

At the moment if i open the page it give me all informations that are in the database, at last i want just to see the products that i search for ... any one could help please :( getting really frustrated


Your <input> tag has no name attribute, so it populates no keys in $_GET.

Add name="search" to the input tag, then $_GET['search'] will have what you searched for.

You are confusing the meaning/purpose of id and name. id just provides a target for javascript/CSS, it is not something that becomes part of the form data.

0

精彩评论

暂无评论...
验证码 换一张
取 消