⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 confirmorder.php

📁 《PHP专业项目实例开发》源代码
💻 PHP
字号:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<p>&nbsp;</p>
<hr>
<table width="950" border="0" align="center" cellspacing="1" cellpadding="3">
  <tr> 
    <td width="85%" height="229"> 
      <form name="form2" method="post" action="viewshoppingcart.php">
        <table width="100%" border="5" align="center" cellspacing="0" cellpadding="3">
          <tr bgcolor=#cccccc> 
            <td ><center><b>Order Confirmed</b></center></td>
        </tr>	<tr> 	  <td>   <?php
$database="books";
$hostname="";
$dbusername="root";
$dbpassword="";

$connect=mysql_connect($hostname,$dbusername,$dbpassword);
$dbselect=mysql_select_db($database);

$query="select productid from neworder where customerid='".$customerid."'";
$result=mysql_query($query);
if(!($row=mysql_fetch_array)){ die("your shopping cart is empty!");}if(!isset($total)){ die("Shopping cart amount is zero !");}if(empty($total)){ die("Shopping cart amount is zero !");}
$query="select MAX(orderid) as orderid from orders";
$result=mysql_query($query);
if($row=mysql_fetch_array($result))
{ $neworderid=++$row["orderid"];
} $dt=getdate();$dateformat=$dt["year"]."-".$dt["mon"]."-".$dt["mday"];$query="INSERT into orders VALUES('".$neworderid."','".$customerid."','".$dateformat."','".$total."','Pending')";$result=mysql_query($query);
if (!($result)){ die("Order entry failed!");}$query="select productid from neworder where customerid='".$customerid."'";
$result=mysql_query($query);
while($row=mysql_fetch_array($result))
{
 $query2 = "INSERT into products_ordered VALUES('','".$row["productid"]."','".$neworderid."')"; $result2=mysql_query($query2);
if (!($result2)){ die("Products entry for this order failed!");} } 
$query="delete from neworder where customerid='".$customerid."'";
$result=mysql_query($query);
if(!($result)){ die("Shopping cart could not be trashed!");}else{ echo "<br><b>Congratulations ! Your order has been successfully sent for processing.</b><br>"; echo "An email will be sent to you with payment options after your order has been reviewed by the administrator.";}?>
</td></tr></table><?phpecho "To return to the website <a href=\"mainpage.php?customerid=".$customerid."\">click here!</a></td>";
        ?><p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -