我首先为这个问题道歉。我试图在 sale_price 部分填写数据,但仍然无效。
R1。我的 sale4.php 没问题。我用这个网址试过了,它有我需要的回报。
sale4.php?q=三星%20Galaxy%20S4
R2。我的 test.php 没问题。IT 返回/填充了从 sale4.php 获得的值
但在我的 cash.php 文件中,它运行良好。谁能告诉我什么是错的?屏幕截图: 解释:
- test.php:向 sale4.php 发送获取请求
- sale4.php 使用 $_GET var 返回销售价格。
- cash.php 获得的应用文件为test.php。我的文件如下-
// sale4.php
<?php
include('../_db/_con.php');
$m=$_GET['q'];
$que="SELECT `purchase_list`.`sale_price` , `purchase_list`.`pur_id`
FROM `purchase_list`
JOIN `item_info` ON `purchase_list`.`item_id` = `item_info`.`item_id`
WHERE `purchase_list`.`sale_price` <>0 AND `item_info`.`item_name` = '$m'";
$result = $mysqli->query($que);
$y=$result->fetch_array(MYSQLI_NUM);
echo $y['0'];
include('../_db/con_.php');
?>
//test.php
<html><head><title>hello</title></head><body>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
</script>
<script>
function sale_price(itemed)
{
$(document).ready(function()
{
$.get("sale4.php?q="+itemed,function(data,status)
{
$("#sale").val(data);
//alert("Data: " + data + "\nStatus: " + status);
});
});
}
</script>
<input onChange="sale_price(this.value)" value="Mobile battery">
<input id="sale" value="<?php
$msg='fdf'; print $msg; ?>">
</div>
</body>
</html>
// 现金.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Epos</title>
<link rel="stylesheet" href="http://localhost/epos/css/jquery-ui.css" />
<style type="text/css">
#body{
margin:0 auto;
width:1000px;
}
#main{
font-size: 40px;
color:#039;
font-weight:bold;
font-family:"Courier New", Courier, monospace;
}
#bottom{
font-size: 12px;
color:#039;
font-weight:bold;
font-family:"Courier New", Courier, monospace;
background-color: #DDDDDD;
}
#menuWrapper {
width:1000px; /* Menu width */
height:35px;
padding-left:14px;
background-color: #fff;
border-radius: 10px; /* Menu border roundedness */
}
.menu {
padding:0;
margin:0;
list-style:none;
height:35px;
position:relative;
z-index:5;
font-family:arial, verdana, sans-serif;
}
.menu li:hover li a {
background-color:#C0C0C0;
}
.menu li.top {display:block; float:left;}
.menu li a.top_link {
display:block;
float:left;
height:35px;
line-height:34px;
background-color:#C0C0C0;
color:#000;
text-decoration:none;
font-family:"Verdana", sans-serif;
font-size:16px; /* Tama�o de la fuente */
font-weight:bold;
padding:0 0 0 12px;
cursor:pointer;
}
.menu li a.top_link span {
float:left;
display:block;
padding:0 24px 0 12px;
height:35px;
width:146px;
}
.menu li a.top_link:hover, .menu li:hover > a.top_link {color:#000; }
.menu li:hover {position:relative; z-index:2;}
.menu ul
{position:absolute; left:-9999px; top:-9999px; width:0; height:0; margin:0; padding:0; list-style:none;}
.menu li:hover ul.sub {
left:0;
top:35px;
background:#CBE4E4; /* Submenu background color */
padding:3px;
color:#000;
white-space:nowrap;
width:200px;
height:auto;
z-index:3;
}
.menu li:hover ul.sub li a{
display:block;
height:30px;
width:200px;
line-height:30px;
text-indent:5px;
color:#000;
font-size:16px;
font-weight:600;
text-decoration:none;
}
.menu li:hover ul.sub li a:hover {
background: #0779F8; /* Background Color on mouseover */
color:#fff;
}
table{
margin:0 auto;
}
.h1{
font-size:72px;;
text-align:center;
}
</style>
</head>
<body>
<div id="body">
<center>
<span class="h1">EPOS</span>
</center>
<div id="menuWrapper">
<ul class="menu">
<li class="top">
<a class="top_link" href="http://localhost/epos/master/user.php"><span class="top">Epos</span></a>
<ul class="sub">
<li class="top"><a href="http://localhost/epos/master/user.php">Admin setup</a></li>
<li class="top"><a href="http://localhost/epos/?q=group-master">Company setup</a></li>
<li class="top"><a href="http://localhost/epos/logout.php">Logout</a></li>
</ul>
<span> </span>
<li class="top">
<a class="top_link" href="http://localhost/epos/master/user.php"><span class="top">Master</span></a>
<ul class="sub">
<li class="top"><a href="http://localhost/epos/master/user.php">User master</a></li>
<li class="top"><a href="http://localhost/epos/?q=group-master">Group master</a></li>
<li class="top"><a href="http://localhost/epos/master/units.php">Unit master</a></li>
<li class="top"><a href="http://localhost/epos/master/categories.php">Category master</a></li>
<li class="top"><a href="http://localhost/epos/master/item.php">Item master</a></li>
</ul>
<span> </span>
<li class="top"><a class="top_link" href="http://localhost/epos/?go=rent"><span class="top">Market</span></a>
<ul class="sub">
<li class="top"><a href="http://localhost/epos/market/cash.php">Cash sale</a></li>
<li class="top"><a href="http://localhost/epos/market/credit.php">Credit sale</a></li>
<li class="top"><a href="http://localhost/epos/market/cash-ps.php">Cash purchase</a></li>
<li class="top"><a href="http://localhost/epos/market/credit-ps.php">Credit purchase</a></li>
<li class="top"><a href="http://localhost/epos/market/cash-ps2.php">Cash purchase2</a></li>
<li class="top"><a href="http://localhost/epos/market/credit-ps2.php">Credit purchase2</a></li>
</ul>
<span> </span></li>
<li class="top"><a class="top_link" href="http://localhost/epos/?go=account"><span class="top">Account</span></a>
<span> </span></li>
<li class="top"><a class="top_link" href="?go=reports"><span class="top">Reports</span></a></li>
</ul>
</div></header>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
function sale_price(itemed)
{
$(document).ready(function()
{
$.get("sale4.php?q="+itemed,function(data,status)
{
$("#sale").val(data);
//alert("Data: " + data + "\nStatus: " + status);
});
});
}
</script>
<script>
$(function() {
var items = ["Motorola Razr HD",
"iPhone 4",
"Samsung Galaxy S3",
"Motorola Razr HD",
"Mobile equipment",
"Mobile equipment",
"Samsung Galaxy S4",
"Mobile equipment",
"Mobile equipment",
"Samsung Galaxy S4",
"Mobile equipment",
"Mobile equipment",
"Sony Xperia S",
"Walton Mobile",
"Mobile",
""
];
$( "#item" ).autocomplete({
source: items
});
var dates = [
"",
"20/7/2013"
];
$( "#day" ).autocomplete({
source: dates
});
});
</script>
<style type="text/css">
.y2
{
background-color:#DDDDDD;
}
.scope
{
background-color:#CCCCCC;
padding:4px;
}
.y1
{
width:25px;
background-color:#DDDDDD;
}
.y21
{
width:55px;
background-color:#DDDDDD;
}
#txt
{
width:200px;
height:25px;
}
#input{
background-color:#666666;
color:#fff;
font-size:16px;
border:#000 1px solid;
padding:2px;
font-weight:600;
}
td
{
padding:3px;
vertical-align:top;
}
th
{
width:300px;
}
.ordel
{
width:300px;
}
</style>
<div id="hello"></div>
<form action="cash.php" method="post" name="users">
<table width="400" border="0" class="ui-widget">
<tr>
<th class="col">Date</th>
<th class="col">Customer</th>
<th class="col">Note</th>
<th class="col">Item</th>
<th class="col">Quantity</th>
<th class="col">Vat(%)</th>
</tr><input name="form" value="usr" type="hidden">
<tr>
<td><input size="10" name="date" id="day" value="20/7/2013" type="text"></td>
<td><input size="20" name="customer" id="customer" value="" type="text"></td>
<td><textarea id="txt" name="note" id="info"></textarea></td>
<td><input onChange="sale_price(this.value)" size="20" name="item_name" id="item" value="" type="text"></td>
<td><input size="10" name="qty" id="qty" value="" type="text"></td>
<td><input name="vat" size="5" id="vat" value="" type="text"></td>
</tr>
<tr>
<th align="left" colspan="3">Sale Price:
<input id="salep" name="sale" size="5" value="" type="text">
Profit:
<input disabled="disabled" name="price" size="5" value="" type="text"></th><th align="left" colspan="5">
<input name="add" value="Add new" id="input" type="submit"> <input name="go" size="4" value="" placeholder="10" id="lab" type="text">
<input name="goto" value="Go to S.N." id="input" type="submit">
<input value="Delete" name="delete" id="input" type="submit"></th>
</tr>
</table>
<table>
<tr>
<th style="width:25px;" class="scope">#</th>
<th style="width:145px;" class="scope">Date</th>
<th style="width:225px;" class="scope">Customer</th>
<th style="width:645px;" class="scope">Note</th>
<th style="width:205px;" class="scope">Item</th>
<th style="width:25px;" class="scope">Sale(each)</th>
<th style="width:25px;" class="scope">Bye(each)</th>
<th style="width:35px;" class="scope">Quantity</th>
<th style="width:25px;" class="scope">Vat</th>
</tr>
<tr>
<td class="y1">1</td>
<td class="y21">18 July 2013</td>
<td class="scope"></td>
<td class="y2"><i></i></td>
<td class="y2">Mobile</td>
<td class="y2">11111111</td>
<td class="y2">444444</td>
<td class="y2">4 Taka</td>
<td class="y2">10%</td>
</tr>
<tr>
<td class="y1">2</td>
<td class="y21">20 July 2013</td>
<td class="scope">Shiam</td>
<td class="y2"><i>asdf</i></td>
<td class="y2">Huawei Ascend G330</td>
<td class="y2">0</td>
<td class="y2">78</td>
<td class="y2">8 piece</td>
<td class="y2">10%</td>
</tr>
<tr>
<td class="y1">3</td>
<td class="y21">20 July 2013</td>
<td class="scope">Shiam</td>
<td class="y2"><i>asdf</i></td>
<td class="y2">Huawei Ascend G330</td>
<td class="y2">0</td>
<td class="y2">78</td>
<td class="y2">8 piece</td>
<td class="y2">10%</td>
</tr></table>
</form>
</div>
</body>
</html>