A-AA+then

Do you want to open or save this file? [PHP]

2,157

    ทำไมเวลาผมส่งค่าแบบ POST ไปยังอีกไฟล์จะขึ้น

     Do you want to open or save this file?

     

    ไฟล์ที่รับค่า จะมี code ประมาณนี้ครับ

     

    <?  ob_start();
     session_start();
     header("content-type: application/x-javascript; charset=tis-620");

     include ("db/connect.php");
    ?>
    <LINK href="style/style.css" type=text/css rel=stylesheet>
    <script src="lib/ajax.js" type="text/javascript"></script>
    <table id="TbViewOrder">
     <tr>
      <td id="Td0" colspan="7">ORDER</td>
     </tr>
     <tr>
      <td colspan="7" align="center"><br class="Space" /></td>
     </tr>
     <?php
      require("db/connect.php");

      $name = $_POST[name];
      $lname = $_POST[lname];
      $address = $_POST[address];
      $country = $_POST[country];
      $city = $_POST[city];
      $postcode = $_POST[postcode];
      $email = $_POST[email];
      $tel = $_POST[tel];
      $total_order = $_POST[total_order];
      $total_price_hid = $_POST[total_price_hid];
      $code = $_POST[code];

      if($sess_id!="")
       {
        if($code==$_SESSION['verify_value'])
         {
          $datenow = date("d/m/Y H:i:s");
          $sql = "insert into order_list values(null,'$name','$lname','$email','$tel','$address','$country','$city','$postcode','$total_order','$datenow')";
          mysql_db_query($dbname,$sql);

          $sql2 = "select max(id_order) from order_list" ;
          $result2 = mysql_db_query($dbname,$sql2);
          $row = mysql_fetch_row($result2);

          $sql_pre = "select id_order,name_order from order_list where id_order='$row[0]'";
          $result1 = mysql_db_query($dbname,$sql_pre);
          $rs=mysql_fetch_array($result1);
          $id_order=$rs[id_order];
          $id_orders=sprintf("%05d",$id_order);

          for($i=0;$i<count($sess_id);$i++)
           {
            if($sess_price_reduce[$i]==0)
             {
              $sql3 = "insert into order_detail values('$row[0]','$sess_id[$i]','$sess_num[$i]','$sess_price[$i]')";
              mysql_db_query($dbname,$sql3);
             }
            else
             {
              $sql3 = "insert into order_detail values('$row[0]','$sess_id[$i]','$sess_num[$i]','$sess_price_reduce[$i]')";
              mysql_db_query($dbname,$sql3);
             }
            }
        ?>

          <tr>
           <td colspan="7" align="center">
            <?
             if($email!="" && $id_orders!="" && $name!="")
              {
               $to_s = $email;
               $subject_s = "your detail form xxx.com";
               $from_s = "info@xxx.com";
               $message_s = "purchase order ID : ".$id_orders." / first name : ".$name." / total price : ".$total_price_hid." | <a href='http://www.xxx.com/main/payment_way.php'>Bank of payment!!</a>";
               $header = "MIME-Version: 1.0\r\n";
               $header .= "Content-type: text/html; charset=windows-874\r\n";
               $header .= "From: ".$from_s;

               if(mail(iconv( 'UTF-8' , 'TIS-620' , $to_s ), iconv( 'UTF-8' , 'TIS-620' , $subject_s ), iconv( 'UTF-8' , 'TIS-620' , $message_s ),  iconv( 'UTF-8' , 'TIS-620' , $header )))
                {
                 $status = "<font class='complete'>mail process complete</font>";
                }
               else
                {
                 $status = "<font class='require'>mail process uncomplete please try agin!!</font>";
                }

                 echo $status."<p>";
              }
            ?>
            <font class="complete">order process complete!!</font><br /><br class="Space-1"><br />
            <font class="require">purchase order ID</font> : <?php echo $id_orders?><br />
            <font class="require">first name</font> : <?php echo $name;?><br /><br class="Space-1"><br />
            xxx are sent <font class="require">purchase order ID</font> and <font class="require">first name</font> for confirm payment to your email.<br /><br class="Space-1"><br />
            we will send product after you are confirm payment complete.<br /><br class="Space-1">
            
            <!-- [ <a href="javascript:getDataReturnText3('view_purchase_order.php?id_order=<?php echo $id_order?>&<?php echo $time=date('YmdHis');?>','TbViewOrder')">view purchase order</a> ] -->
           </td>
          </tr>
          <?
          session_unregister("sess_id");
          session_unregister("sess_name");
          session_unregister("sess_price");
          session_unregister("sess_price_reduce");
          session_unregister("sess_num");

          mysql_close();
         }
        else
         {?>
          <tr>
           <td colspan="7" align="center">
            <font class="require">security code not true!!</font><br /><br class="Space-1">
            system is back to previous page automatically. <META HTTP-EQUIV='Refresh' CONTENT='5;URL=product_order.php'><br /><br class="Space">
            or click &nbsp;<input type="button" name="Back" value="<< Back" onClick='jascript:history.go(-1)' id="SubmitButton">&nbsp; for back to previous page.
           </td>
          </tr>
        <?}
       }
      else
       {?>

        <tr>
         <td colspan="7" align="center"><font class="require">out of order!!</font><br /><br class="Space-1"></td>
        </tr>
       <?}?>
    </table>

     

     

      มันเป็นเพราะอะไรครับ รบกวนด้วยนะครับ

      ขอบคุณมากครับ

2 ความคิดเห็น

header("content-type: application/x-javascript; charset=tis-620");

ลองเปลี่ยนเป็น

header("content-type: text/html; charset=tis-620");

หรือ เอาออกไปเลยครับ
1

    ได้แล้วครับ ผมเปลี่ยนตามที่บอกไว้เลยครับ ขอบคุณมากครับ

2
^