保持相同的样式表和显示数据相同的页面问题
keeping the same stylesheet and display data same page issue
index.html
的代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
include ('recherchecommande.php') ;
?>
<title>Pâtisserie Baya</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" media="all" href="styles/960.css" />
<link rel="stylesheet" type="text/css" media="all" href="styles/reset.css" />
<link rel="stylesheet" type="text/css" media="all" href="styles/text.css" />
<link rel="stylesheet" type="text/css" media="all" href="style.css" />
<link rel="stylesheet" type="text/css" media="all" href="themes/brown/style.css" />
<link rel="stylesheet" type="text/css" media="all" href="styles/sample.css" />
<link rel="stylesheet" type="text/css" media="all" href="styles/table.css" />
<script type="text/javascript" src="scripts/jquery-1.4.2.js"></script>
<script type="text/javascript" src="scripts/jquery.tools.min.js"></script>
<script type="text/javascript" src="scripts/dapur.js"></script>
</head>
<body>
<div id="warp" >
<div id="main" class="container_16">
<div id="header" class="grid_16">
<div id="logo" class="grid_4 alpha">
<h1><a href="index.html">DapurKue</a></h1>
<h2>Famously Delicious</h2>
</div>
<div id="headright" class="grid_7 prefix_5 omega">
<h3 class="login"><a href="login.html">Sign up</a> / <a href="login.html">Login</a></h3>
<p><span class="vChart"><a href="shoppingcart.html">View Cart</a></span> <span class="cOut"><a href="checkout.html">Checkout</a></span></p>
</div>
</div>
<div id="mainMenu" class="grid_16">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="#">Cakes</a></li>
<li><a href="#">Order & Delivery</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li><a href="reclamation.html">Reclamation</a></li>
</ul>
</div>
<div id="stickySearch" class="grid_16">
<div class="stickyNews grid_12 alpha">
<p>Valentine’s BrownieCheese Special Package. <em>Free Delivery.</em> <a href="#" class="bookMan">More »</a></p>
</div>
<div class="search grid_4 omega">
<form action="#" method="get">
<input type="text" value="Type your keyword" id="s" name="s" onFocus="if (this.value == 'Type your keyword') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Type your keyword';}" />
</form>
</div>
</div>
<div class="products grid_16">
<div class="productsWarp" id="style1"><a href="mailto:someone@example.com"><img src="images\email.png"></a></div>
<div id="style2" /> </div>
<div id ="style3">
<h3>Recherche par numero de commande</h3>
<p> Searcch button</p>
<form action="recherchecommande.php?go" id="commandeForm" method="post">
<input placeholder="Numero de commande.." id="form2" type="text" name="numero">
<input type="submit" name="submit" style="display: none" /><br>
</form>
</div>
<div id="style1"></div>
</div>
<div class="productThumb ">
<ul>
<li class="grid_2 alpha"><a href="#"><img src="images/cake1.jpg" alt="" width="100" height="60" /></a></li>
<li class="grid_2"><a href="#"><img src="images/cake2.jpg" alt="" width="100" height="60" /></a></li>
<li class="grid_2"><a href="#"><img src="images/cake3.jpg" alt="" width="100" height="60" /></a></li>
<li class="grid_2"><a href="#"><img src="images/cake4.jpg" alt="" width="100" height="60" /></a></li>
<li class="grid_2"><a href="#"><img src="images/cake5.jpg" alt="" width="100" height="60" /></a></li>
<li class="grid_2"><a href="#"><img src="images/cake6.jpg" alt="" width="100" height="60" /></a></li>
<li class="grid_2"><a href="#"><img src="images/cake7.jpg" alt="" width="100" height="60" /></a></li>
<li class="grid_2 omega"><a href="#"><img src="images/cake8.jpg" alt="" width="100" height="60" /></a></li>
</ul>
</div>
</div>
<div class="clear"></div>
</div>
<div id="fresh">
<div class="container_16">
<div id="freshCake" class="grid_16">
<div class="grid_1 alpha"> <a class="prevButton">«</a></div>
<div class="headLine grid_14">
<h3>Fresh from the oven</h3>
</div>
<div class="grid_1 omega"> <a class="nextButton">»</a></div>
</div>
<div class="newCakes">
<div class="scroller">
<div class="newCake"><a href="product-details.html" class="grid_4"><img src="images/freshCake1.jpg" alt="" width="220" height="120" /></a></div>
<div class="newCake"><a href="product-details.html" class="grid_4"><img src="images/freshCake2.jpg" alt="" width="220" height="120" /></a></div>
<div class="newCake"><a href="product-details.html" class="grid_4"><img src="images/freshCake3.jpg" alt="" width="220" height="120" /></a></div>
<div class="newCake"><a href="product-details.html" class="grid_4"><img src="images/freshCake4.jpg" alt="" width="220" height="120" /></a></div>
<div class="newCake"><a href="product-details.html" class="grid_4"><img src="images/freshCake5.jpg" alt="" width="220" height="120" /></a></div>
<div class="newCake"><a href="product-details.html" class="grid_4"><img src="images/freshCake6.jpg" alt="" width="220" height="120" /></a></div>
<div class="newCake"><a href="product-details.html" class="grid_4"><img src="images/freshCake7.jpg" alt="" width="220" height="120" /></a></div>
<div class="newCake"><a href="product-details.html" class="grid_4"><img src="images/freshCake8.jpg" alt="" width="220" height="120" /></a></div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
<div id="richContent">
<div class="container_16">
<div class="popularCakes grid_4">
<h4>Popular Cakes</h4>
<ul>
<li><a href="#">Ultimate Choco Brownie</a></li>
<li><a href="#">Mokakokoa Brownie</a></li>
<li><a href="#">CoffeeBrown</a></li>
<li><a href="#">Delicacheese</a></li>
<li><a href="#">Berries Cheesecake</a></li>
</ul>
</div>
<div class="recommended grid_4">
<h4>Recommended</h4>
<ul>
<li><a href="#">Ultimate Choco Brownie</a></li>
<li><a href="#">Mokakokoa Brownie</a></li>
<li><a href="#">CoffeeBrown</a></li>
<li><a href="#">Delicacheese</a></li>
<li><a href="#">Berries Cheesecake</a></li>
</ul>
</div>
<div class="specialOffer grid_4">
<h4>Special Offer</h4>
<ul>
<li><a href="#">Ultimate Choco Brownie</a></li>
<li><a href="#">Mokakokoa Brownie</a></li>
<li><a href="#">CoffeeBrown</a></li>
<li><a href="#">Delicacheese</a></li>
<li><a href="#">Berries Cheesecake</a></li>
</ul>
</div>
<div class="orderPhone grid_4">
<h4><em>Order by Phone</em> <span>20.321.331</span></h4>
</div>
<div class="clear"></div>
</div>
</div>
<div id="richContent2">
<div class="container_16">
<div class="fromBlog grid_4">
<h4>From the blog</h4>
<h5>New Recipes in Our Basket</h5>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. vivamus tempor justo sit amet metus cursus consequat. Nulla viverra, felis vel accumsan fermentum... <a href="#" class="bookMan">more »</a></p>
</div>
<div class="corporateInfo grid_4">
<h4>Corporate Info</h4>
<ul>
<li><a href="#">Privacy Policy</a></li>
<li><a href="#">Term & Conditions</a></li>
<li><a href="#">Franchise</a></li>
<li><a href="#">About us</a></li>
<li><a href="#">FAQ</a></li>
</ul>
</div>
<div class="storeDelivery grid_4">
<h4>Store & Delivery</h4>
<ul>
<li><a href="#">Store Locator</a></li>
<li><a href="#">Delivery Terms & Pricing</a></li>
<li><a href="#">Delivery Coverage</a></li>
<li><a href="#">Gift Services</a></li>
<li><a href="#">Track my order</a></li>
</ul>
</div>
<div class="socialNet grid_4">
<h4>Keep in touch</h4>
<ul>
<li><a href="#" class="facebook">Facebook</a></li>
<li><a href="#" class="twitter">Twitter</a></li>
<li><a href="#" class="feed">Feed</a></li>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
<div id="footer">
<div class="container_16">
<div class="copyright grid_16">
<p class="left">Copyright © 2016, Athenas, All Rights Reserved</p>
<p class="right">Design by <a href="http://tokokoo.com/">Tokokoo</a> & <a href="http://www.instantshift.com/">instantShift</a></p>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</div>
</body>
</html>
search.php
的代码
<?php
include ('connect.php') ;
$mysqli = new mysqli("localhost", "root", "", "baya");
if(isset($_POST['submit'])){
if(isset($_GET['go'])){
$cmd=$_POST['numero'];
$sql="SELECT * from commande WHERE commande_id LIKE ".$cmd."";
$result=mysqli_query($db,$sql);
$number=$result->num_rows ;
echo "
" ;
if ($number==1)
{
while($row=mysqli_fetch_assoc($result))
{
$commande_id =$row['commande_id'];
$description=$row['description'];
$status=$row['status'];
$report=$row['report'] ;
echo "
<table border=1>
<thead>
<tr>
<th>commande_id</th>
<th>description</th>
<th>status</th>
<th>report</th>
</tr>
</thead>
<tr>
<td>$commande_id</td>
<td>$description</td>
<td>$status</td>
<td>$report</td>
</tr>
";
header('location reclamation.html') ;
}
}
else{
echo "<p>Command id n'existe pas</p>";
}
}
}
else{
echo "search query is empty" ;
}
?>
我想在同一页面而不是另一个页面中显示查询
例如,如果我键入 1,它应该 returns 来自数据库的查询
不要在另一页显示结果..
是否可以在搜索按钮的底部显示结果
同款sheet!
谢谢大家的帮助!
最好的问候
像这样更改您的表单操作属性
<form action="" mehtode="post">
并在同一页面上编写php代码来处理数据发送。
<?php
if(isset($_POST['submit'])){
//process the form
//output
// etc....
}
?>
请post代码示例。所以我们可以看看它。
您可以使用其他 php 包含与您其他 php 具有相同 css 和 html 结构的文件,或者您可以使用 Ajax使用 javascript 获取数据然后显示它。
$.ajax({
method: "POST",
url: "some.php",
data: { name: "John", location: "Boston" }
})
.done(function( msg ) {
alert( "Data Saved: " + msg );
});
index.html
的代码<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
include ('recherchecommande.php') ;
?>
<title>Pâtisserie Baya</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" media="all" href="styles/960.css" />
<link rel="stylesheet" type="text/css" media="all" href="styles/reset.css" />
<link rel="stylesheet" type="text/css" media="all" href="styles/text.css" />
<link rel="stylesheet" type="text/css" media="all" href="style.css" />
<link rel="stylesheet" type="text/css" media="all" href="themes/brown/style.css" />
<link rel="stylesheet" type="text/css" media="all" href="styles/sample.css" />
<link rel="stylesheet" type="text/css" media="all" href="styles/table.css" />
<script type="text/javascript" src="scripts/jquery-1.4.2.js"></script>
<script type="text/javascript" src="scripts/jquery.tools.min.js"></script>
<script type="text/javascript" src="scripts/dapur.js"></script>
</head>
<body>
<div id="warp" >
<div id="main" class="container_16">
<div id="header" class="grid_16">
<div id="logo" class="grid_4 alpha">
<h1><a href="index.html">DapurKue</a></h1>
<h2>Famously Delicious</h2>
</div>
<div id="headright" class="grid_7 prefix_5 omega">
<h3 class="login"><a href="login.html">Sign up</a> / <a href="login.html">Login</a></h3>
<p><span class="vChart"><a href="shoppingcart.html">View Cart</a></span> <span class="cOut"><a href="checkout.html">Checkout</a></span></p>
</div>
</div>
<div id="mainMenu" class="grid_16">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="#">Cakes</a></li>
<li><a href="#">Order & Delivery</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li><a href="reclamation.html">Reclamation</a></li>
</ul>
</div>
<div id="stickySearch" class="grid_16">
<div class="stickyNews grid_12 alpha">
<p>Valentine’s BrownieCheese Special Package. <em>Free Delivery.</em> <a href="#" class="bookMan">More »</a></p>
</div>
<div class="search grid_4 omega">
<form action="#" method="get">
<input type="text" value="Type your keyword" id="s" name="s" onFocus="if (this.value == 'Type your keyword') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Type your keyword';}" />
</form>
</div>
</div>
<div class="products grid_16">
<div class="productsWarp" id="style1"><a href="mailto:someone@example.com"><img src="images\email.png"></a></div>
<div id="style2" /> </div>
<div id ="style3">
<h3>Recherche par numero de commande</h3>
<p> Searcch button</p>
<form action="recherchecommande.php?go" id="commandeForm" method="post">
<input placeholder="Numero de commande.." id="form2" type="text" name="numero">
<input type="submit" name="submit" style="display: none" /><br>
</form>
</div>
<div id="style1"></div>
</div>
<div class="productThumb ">
<ul>
<li class="grid_2 alpha"><a href="#"><img src="images/cake1.jpg" alt="" width="100" height="60" /></a></li>
<li class="grid_2"><a href="#"><img src="images/cake2.jpg" alt="" width="100" height="60" /></a></li>
<li class="grid_2"><a href="#"><img src="images/cake3.jpg" alt="" width="100" height="60" /></a></li>
<li class="grid_2"><a href="#"><img src="images/cake4.jpg" alt="" width="100" height="60" /></a></li>
<li class="grid_2"><a href="#"><img src="images/cake5.jpg" alt="" width="100" height="60" /></a></li>
<li class="grid_2"><a href="#"><img src="images/cake6.jpg" alt="" width="100" height="60" /></a></li>
<li class="grid_2"><a href="#"><img src="images/cake7.jpg" alt="" width="100" height="60" /></a></li>
<li class="grid_2 omega"><a href="#"><img src="images/cake8.jpg" alt="" width="100" height="60" /></a></li>
</ul>
</div>
</div>
<div class="clear"></div>
</div>
<div id="fresh">
<div class="container_16">
<div id="freshCake" class="grid_16">
<div class="grid_1 alpha"> <a class="prevButton">«</a></div>
<div class="headLine grid_14">
<h3>Fresh from the oven</h3>
</div>
<div class="grid_1 omega"> <a class="nextButton">»</a></div>
</div>
<div class="newCakes">
<div class="scroller">
<div class="newCake"><a href="product-details.html" class="grid_4"><img src="images/freshCake1.jpg" alt="" width="220" height="120" /></a></div>
<div class="newCake"><a href="product-details.html" class="grid_4"><img src="images/freshCake2.jpg" alt="" width="220" height="120" /></a></div>
<div class="newCake"><a href="product-details.html" class="grid_4"><img src="images/freshCake3.jpg" alt="" width="220" height="120" /></a></div>
<div class="newCake"><a href="product-details.html" class="grid_4"><img src="images/freshCake4.jpg" alt="" width="220" height="120" /></a></div>
<div class="newCake"><a href="product-details.html" class="grid_4"><img src="images/freshCake5.jpg" alt="" width="220" height="120" /></a></div>
<div class="newCake"><a href="product-details.html" class="grid_4"><img src="images/freshCake6.jpg" alt="" width="220" height="120" /></a></div>
<div class="newCake"><a href="product-details.html" class="grid_4"><img src="images/freshCake7.jpg" alt="" width="220" height="120" /></a></div>
<div class="newCake"><a href="product-details.html" class="grid_4"><img src="images/freshCake8.jpg" alt="" width="220" height="120" /></a></div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
<div id="richContent">
<div class="container_16">
<div class="popularCakes grid_4">
<h4>Popular Cakes</h4>
<ul>
<li><a href="#">Ultimate Choco Brownie</a></li>
<li><a href="#">Mokakokoa Brownie</a></li>
<li><a href="#">CoffeeBrown</a></li>
<li><a href="#">Delicacheese</a></li>
<li><a href="#">Berries Cheesecake</a></li>
</ul>
</div>
<div class="recommended grid_4">
<h4>Recommended</h4>
<ul>
<li><a href="#">Ultimate Choco Brownie</a></li>
<li><a href="#">Mokakokoa Brownie</a></li>
<li><a href="#">CoffeeBrown</a></li>
<li><a href="#">Delicacheese</a></li>
<li><a href="#">Berries Cheesecake</a></li>
</ul>
</div>
<div class="specialOffer grid_4">
<h4>Special Offer</h4>
<ul>
<li><a href="#">Ultimate Choco Brownie</a></li>
<li><a href="#">Mokakokoa Brownie</a></li>
<li><a href="#">CoffeeBrown</a></li>
<li><a href="#">Delicacheese</a></li>
<li><a href="#">Berries Cheesecake</a></li>
</ul>
</div>
<div class="orderPhone grid_4">
<h4><em>Order by Phone</em> <span>20.321.331</span></h4>
</div>
<div class="clear"></div>
</div>
</div>
<div id="richContent2">
<div class="container_16">
<div class="fromBlog grid_4">
<h4>From the blog</h4>
<h5>New Recipes in Our Basket</h5>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. vivamus tempor justo sit amet metus cursus consequat. Nulla viverra, felis vel accumsan fermentum... <a href="#" class="bookMan">more »</a></p>
</div>
<div class="corporateInfo grid_4">
<h4>Corporate Info</h4>
<ul>
<li><a href="#">Privacy Policy</a></li>
<li><a href="#">Term & Conditions</a></li>
<li><a href="#">Franchise</a></li>
<li><a href="#">About us</a></li>
<li><a href="#">FAQ</a></li>
</ul>
</div>
<div class="storeDelivery grid_4">
<h4>Store & Delivery</h4>
<ul>
<li><a href="#">Store Locator</a></li>
<li><a href="#">Delivery Terms & Pricing</a></li>
<li><a href="#">Delivery Coverage</a></li>
<li><a href="#">Gift Services</a></li>
<li><a href="#">Track my order</a></li>
</ul>
</div>
<div class="socialNet grid_4">
<h4>Keep in touch</h4>
<ul>
<li><a href="#" class="facebook">Facebook</a></li>
<li><a href="#" class="twitter">Twitter</a></li>
<li><a href="#" class="feed">Feed</a></li>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
<div id="footer">
<div class="container_16">
<div class="copyright grid_16">
<p class="left">Copyright © 2016, Athenas, All Rights Reserved</p>
<p class="right">Design by <a href="http://tokokoo.com/">Tokokoo</a> & <a href="http://www.instantshift.com/">instantShift</a></p>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</div>
</body>
</html>
search.php
的代码<?php
include ('connect.php') ;
$mysqli = new mysqli("localhost", "root", "", "baya");
if(isset($_POST['submit'])){
if(isset($_GET['go'])){
$cmd=$_POST['numero'];
$sql="SELECT * from commande WHERE commande_id LIKE ".$cmd."";
$result=mysqli_query($db,$sql);
$number=$result->num_rows ;
echo "
" ;
if ($number==1)
{
while($row=mysqli_fetch_assoc($result))
{
$commande_id =$row['commande_id'];
$description=$row['description'];
$status=$row['status'];
$report=$row['report'] ;
echo "
<table border=1>
<thead>
<tr>
<th>commande_id</th>
<th>description</th>
<th>status</th>
<th>report</th>
</tr>
</thead>
<tr>
<td>$commande_id</td>
<td>$description</td>
<td>$status</td>
<td>$report</td>
</tr>
";
header('location reclamation.html') ;
}
}
else{
echo "<p>Command id n'existe pas</p>";
}
}
}
else{
echo "search query is empty" ;
}
?>
我想在同一页面而不是另一个页面中显示查询
例如,如果我键入 1,它应该 returns 来自数据库的查询
不要在另一页显示结果.. 是否可以在搜索按钮的底部显示结果 同款sheet!
谢谢大家的帮助! 最好的问候
像这样更改您的表单操作属性
<form action="" mehtode="post">
并在同一页面上编写php代码来处理数据发送。
<?php
if(isset($_POST['submit'])){
//process the form
//output
// etc....
}
?>
请post代码示例。所以我们可以看看它。
您可以使用其他 php 包含与您其他 php 具有相同 css 和 html 结构的文件,或者您可以使用 Ajax使用 javascript 获取数据然后显示它。
$.ajax({
method: "POST",
url: "some.php",
data: { name: "John", location: "Boston" }
})
.done(function( msg ) {
alert( "Data Saved: " + msg );
});