这就是我开始做“搜索表单”的方式,应该是这样一个人正在照顾 Fitnessdk 和nordsjælland所以所有人都挺身而出,
现在的问题是它不会像我一直在寻找它那样。
Php :
if(isset($_POST["sognu"]))
{
if ($stmt = $this->mysqli->prepare('SELECT fms_opslag.id, fms_opslag.title, fms_opslag.undertitle, fms_opslag.fitness, fms_opslag.landsdel, fms_opslag.brugerid, fms_bruger.profilbillede FROM fms_opslag INNER JOIN fms_bruger ON fms_opslag.brugerid=fms_bruger.id WHERE fitness LIKE "%".$fitness."%" AND landsdel LIKE "%".$landsdel."%" ORDER BY fms_opslag.tidspunkt DESC'))
{
$stmt->bind_param('ss', $fitness, $landsdel);
$fitness = $_post["fitness"];
$landsdel = $_post["omrade"];
$stmt->execute();
$stmt->bind_result($id, $title, $undertitle, $fitness, $landsdel, $brugerid, $profilbillede);
while ($stmt->fetch()) {
?>
<tr class="postbox">
<td>
<a href="/profil/<?php echo $brugerid;?>/"><img src="/profil-img/smaa/<?php echo $profilbillede;?>"></a>
</td>
<td class="tabletitle">
<h3><?php echo $title;?></h3>
<p><?php echo $undertitle;?></p>
<?php
if($_SESSION["login"] == true)
{
?>
<form action="/ansog/<?php echo $id;?>/" method="post">
<input type="submit" name="ansoge" value="Ansøg nu" class="kliknuBB">
</form>
<?php
}
?>
</td>
<td class="tableomrade">
<p><?php echo $fitness;?></p>
</td>
<td class="tablemap">
<p><?php echo $landsdel;?></p>
</td>
</tr>
<?php
}
$stmt->close();
}
}
html表单:
<form action="#" method="post">
<div id="search-top">
<div class="infobarindhold">
<p>Fitness center</p>
<select name="fitness" class="bar">
<?php
if ($stmt = $this->mysqli->prepare('SELECT navn FROM fms_fitness')) {
$stmt->execute();
$stmt->bind_result($navn);
while ($stmt->fetch()) {
?>
<option value="<?php echo $navn;?>"><?php echo $navn;?></option>
<?php
}
$stmt->close();
}
?>
</select>
</div>
<div class="infobarindhold">
<p>Placering</p>
<select name="omrade" class="bar">
<?php
if ($stmt = $this->mysqli->prepare('SELECT navn FROM fms_landsdel')) {
$stmt->execute();
$stmt->bind_result($navn);
while ($stmt->fetch()) {
?>
<option value="<?php echo $navn;?>"><?php echo $navn;?></option>
<?php
}
$stmt->close();
}
?>
</select>
</div>
<div class="cl"></div>
</div>
<div id="sogbar">
<input type="submit" name="sognu" value=" " class="sognu">
<div class="cl"></div>
</div>
页面上不会显示任何内容。