this is the view client page
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');
}
?>
this is the checkout page the checkout page takes the username of the client from the previous page which is vclient page.. The database contains two tables .. the first one is the client_info table that has attributes [id, username, password, enabled] .. The enabled attribute is used to activate the account of the client when it equals 1 , and deactivate it when it's 0 .. The second table is the client table [id, balance].. I want to update the two tables as to make the balance equals zero and the enabled = 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');
}
?>