ช่วยแก้หน่อยค่ะ คือ หนูทำระบบจองชุด พอดีมานจะมีให้เลือกว่าจะเช่าชุดหรือเช่าตัดน่ะค่ะ
หน้ารับ
<?php
include "chksession.php"; //check login
include "header.php";
include "connect.php";
$o_id=$_POST[id];
$o_id=$_GET[id];//รับค่าผ่านลิ้งค์
$date = date("Y-m-d");
if($_POST[paytype]){ //กรณีบันทึกชำระเงิน
$paytype =$_POST[paytype];
if($paytype=="เช่าชุด"){
$o_status_rent2="เช่าชุด";
} elseif($paytype=="เช่าตัด"){
$o_status_rent3="เช่าตัด";
}
$sql="select * From orders_detail Where o_id='$o_id'";
$rst=mysql_query($sql);
$row=mysql_fetch_array($rst);
$suite_id=$row["suite_id"];
$sql2="select * From suite Where suite_id='$suite_id'";
$rst2=mysql_query($sql2);
$row2=mysql_fetch_array($rst2);
$suite_id=$row2["suite_id"];
$suite_price_rent=$row2["suite_price_rent"];
$suite_price_cut=$row2["suite_price_cut"];
//echo"$suite_price_cut--$o_status_rent";
//exit();
if($status_rent="$o_status_rent2"){
//echo"$suite_price_cut--$o_status_rent";
//exit();
$sqlpay = "Update orders
Set o_status_rent='$o_status_rent2',nettotal='$suite_price_rent'
Where o_id='$o_id'";
mysql_query($sqlpay);
$sqlpay2= "Update orders_detail
Set price='$suite_price_rent',subtotal='$suite_price_rent'
Where o_id='$o_id'";
mysql_query($sqlpay2);
}elseif($status_rent="$o_status_rent3"){
//echo"$suite_price_cut";
//exit();
$sqlpay = "Update orders
Set o_status_rent='$o_status_rent3',nettotal='$suite_price_cut'
Where o_id='$o_id'";
mysql_query($sqlpay);
$sqlpay2= "Update orders_detail
Set price='$suite_price_cut',subtotal='$suite_price_cut'
Where o_id='$o_id'";
mysql_query($sqlpay2);
$sqlcut = "Insert into extra ( ex_id, ex_date, o_id, suite_id, ex_status )
values ( '', '$date', '$o_id', '$suite_id', 'สั่งตัด' )";
mysql_query($sqlcut);
}
}
//อัปเดตสถานะเป็น 'เช่า'
mysql_query("Update orders Set o_status='เช่า' Where o_id='$o_id'");
echo"<META http-equiv=\"refresh\"CONTENT=\"0;url=updatedetail.php?id=$o_id\">";
?>
Date :
2012-07-14 23:37:37
By :
kam
Load balance : Server 05