0

这是查看客户页面

if($add==$p){
if(!empty($username) && isset($_POST['username'])){
$query = "SELECT id FROM client_info WHERE username = '". $username. "'";
$query_run = mysql_query($query);
$id = mysql_result($query_run);
}
}
?>

<form action='index.php' method="post">
<ul data-role="listview" data-split="gear" data-inset="true">
<li data-theme="b" style="text-align:center">Settle Client</li>
<li>
<div align="center">
<div data-role="fieldcontain" style="width:90%;">
<label for="username">Username : </label> 
<input type="text"  id="username" name="username"/><br>
</div>
</div>
<input type="hidden" name="add" value="<?php if($edt) echo "edt"; else echo $p; ?>" />
<input type="hidden" name="p" value="<?php echo $p; ?>" />
</li>
<li>
    <div align="center">
<div data-role="fieldcontain" style="width:90%;">

<input type="submit"  id="cout" name="cout" value="Check Out"/><br><br>
<input type="submit"  id="print" name="print" value="Print Clients Info"/><br>
</div>
</div></li>
</ul></form>
<?php 
if(isset($_POST['cout']) && $query_run){
header('Location: index.php?p=checkout&username='.$username);
}
else if(isset($_POST['print']) ){
header('Location: ..\print.php');
}
?>

这是结帐页面结帐页面从上一页即vclient页面获取客户端的用户名。数据库包含两个表。第一个是具有属性[id,用户名,密码,启用]的client_info表.. enabled 属性用于在等于 1 时激活客户的帐户,并在为 0 时停用它 .. 第二个表是客户表 [id, balance] .. 我想将这两个表更新为使余额等于 0 并且使能 = 0

<?php
$username = $_GET['username'];
echo "username : ".$username;
$add = $_REQUEST['add'];
$edt = $_REQUEST['edt'];

if($add==$p){
if(isset($username) && isset($_POST['cout'])){

$query="SELECT id From client_info WHERE username = '" . $username . "'";
$query_run=mysql_query($query);
$idc = mysql_result($query_run);}

/*$query="SELECT balance From client WHERE username = '" . $idc . "'";
$query_run=mysql_query($query);
$balance = mysql_result($query_run);*/
if($add=="edt"){
$query1 = "UPDATE client_info SET enabled='0' WHERE id=$idc";
$query_run1=mysql_query($query1);


$query2 = "UPDATE client SET balance='0' WHERE id=$idc";
$query_run2=mysql_query($query2);
}
}
?>

<form action='index.php' method="post">
<ul data-role="listview" data-split="gear" data-inset="true">
<li data-theme="b" style="text-align:center">Check Out Client</li>
<li>
<input type="hidden" name="add" value="<?php if($edt) echo "edt"; else echo $p; ?>" />
<input type="hidden" name="p" value="<?php echo $p; ?>" />
</li>
<li>
    <div align="center">
<div data-role="fieldcontain" style="width:90%;">

<input type="submit"  id="cout" name="cout" value="Check Out"/><br>
</div>
</div></li>
</ul></form>
<?php
if(isset($_POST['cout'])){

header('Location: index.php?p=ocrooms');
}
?>
4

0 回答 0