Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,028

HOME > PHP > PHP Forum > เวลาคลิกลบมันขึ้น error Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\clinicsystem\pay\order.php:6) in C:\AppServ\www\clinicsystem\pay\order.php on line 190



 

เวลาคลิกลบมันขึ้น error Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\clinicsystem\pay\order.php:6) in C:\AppServ\www\clinicsystem\pay\order.php on line 190

 



Topic : 077758

Guest




พอดีว่าทำ ตัดสต๊อกยาคะ มันขึ้นฟ้องว่า Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\clinicsystem\pay\order.php:6) in C:\AppServ\www\clinicsystem\pay\order.php on line 190 เวลาเราคลิกลบ ยาคะ และอีกอย่างคะ เวลาตัดสต๊อกยา มันตัดสต๊อกผิดคะ ไม่ทราบง่าผิดตรงไหนคะ
นี้โค๊ดคะ
Code (PHP)
<? session_start(); ?>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<style>
BODY {
	FONT-FAMILY: Arial, Helvetica, sans-serif;
	background-image: url();
	background-color: #93EAFF;
}
.style38 {
	font-family: AngsanaUPC;
	font-size: 22px;
	font-weight: bold;
}
</style>
<script language="JavaScript" type="text/javascript">
function checkform (form,units)
{
  if (form.qty.value == "") {
    alert( "โปรดกรอกจำนวนยาที่จ่ายด้วย" );
    form.qty.focus();
    return false ;
  }

  if (form.qty.value <= 0) {
     alert( "จำนวนจำนวนยาที่จ่ายต้องมากกว่าศูนย์" );
     form.qty.focus();
     return false ;
  }

  if (form.qty.value != "") {
    var val = form.qty.value;
    var chars = "0123456789"; 
    var len = val.length; 
    var char = ""; 

    for (i=0; i<len; i++)
    { 
         char = val.charAt(i);
         if (chars.indexOf(char)==-1)
        { 
               alert("จำนวนยาที่จ่ายต้องเป็นเลขจำนวนเต็มบวกเท่านั้น");
               form.qty.focus();
               return false;
        }
    }
  }

  if (form.qty.value > units) {
     alert( "ไม่สามารถจำนวนยาที่จ่ายได้ : มีจำนวนยาที่จ่ายไม่เพียงพอ" );
     form.qty.focus();
     return false ;
  }

  return true ;
}
</script>
</head>

<body>
<?php
 $preseway_id= $_GET['preseway_id'];
 $store_id= $_GET['store_id']; // รับรหัสสินค้าเข้ามา (ใช้แบบ GET เพราะส่งผ่าน Browser)
 $unit_drug= $_GET['unit_drug'];
require_once('connect.php'); 
mysql_connect($hostname,$username,$password)or die("can't connect DB");
	mysql_select_db($dbname) or die("can't connect DB");
$query_goods = "SELECT * FROM store  where store_id='$store_id' ;";
$goods = mysql_db_query($dbname,$query_goods) or die(mysql_error());
$row = mysql_num_rows($goods);
$i=0;
  $row_goods= mysql_fetch_array($goods);
      $store_name =$row_goods['store_name'];
      $properties =$row_goods['properties'];
      $advice =$row_goods['advice']; 
	  $store_type =$row_goods['store_type'];
	    $unit_drug =$row_goods['unit_drug'];
	  $price =$row_goods['price'];
	  $stock_store =$row_goods['stock_store'];
?>
<? if($stock_store>0) { ?>
<center>
<!-- ใส่ URL ของไฟล์ cart.php ครับ -->
<form action="order.php" method="post" onSubmit="return checkform(this,<? echo $preseway_id; ?>);">
<input name="store_name" type="hidden" value="<? echo $store_name; ?>">
<input name="price" type="hidden" value="<? echo $price; ?>">
<input type="hidden" name="store_id" value="<? echo $store_id; ?>">
<input type="hidden" name="unit_drug" value="<? echo $unit_drug; ?>">
<input name="store_id" type="hidden" value="<? echo $store_id; ?>" />
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border: 1px dashed #800000" bordercolor="#111111" width="90%" id="AutoNumber1">
  <tr>
    <td width="34%" background="../image/top.jpg" bgcolor="#FFFFFF" style="border: 1px dashed #800000">
    <p align="right"><span class="style38">จำนวนยาที่จ่าย
    :</span>&nbsp;&nbsp; </td>
    <td width="66%" background="../image/top.jpg" bgcolor="#FFFFFF" style="border: 1px dashed #800000">&nbsp;&nbsp;
      <input name="qty" type="text" size="36" maxlength="5">
      <label>
      <select name="unit_drug" id="unit_drug">
        <option selected>กรุณาเลือก</option>
        <option value="เม็ด">เม็ด</option>
        <option value="ขวด">ขวด</option>
        <option value="หลอด">หลอด</option>
        <option value="ชุด">ชุด</option>
        <option value="แพง">แพง</option>
		 <? 
include("include/config.php");
$sql="select * from store order by store_id ASC";
$dbquery=mysql_db_query($db,$sql);
while($result=mysql_fetch_array($dbquery)){
if($store_id == $result[store_id]){ //เพื่อให้ แสดง $pt_id ที่ส่งค่ามาให้ 
?>
            <? 
}else{?>
            <? 
} }
?>
         </select>
      </label></td>
  </tr>
  <tr>
    <td width="100%" colspan="2" background="../image/foot.jpg" bgcolor="#00CCFF" style="border: 1px dashed #800000"><center>
      <input type="submit" value="เพิ่มลงตะกร้ายา" name="submit">
    </center></td>
  </tr>
</table>
</form>
</center>
<p>
  <? }
else {
      echo "<center>
<table border=\"1\" style=\"border-style:dotted; border-collapse: collapse; padding-left:4; padding-right:4; padding-top:1; padding-bottom:1\" bordercolor=\"#111111\" width=\"75%\" id=\"AutoNumber1\" height=\"138\">
  <tr>
    <td height=\"136\">
    <center>
    <font size=\"5\" color=\"#000080\">เพิ่มเรียบร้อยแล้ว</font><br>
    </center>    
    </td>
  </tr>
</table>
</center><br>";
}
?>
</p>
<p align="center"><?php
session_start();
mysql_db_query($db,"SET NAMES tis620");
//Create 'cart' if it doesn't already exist
if (!isset($_SESSION['SHOPPING_CART'])){ $_SESSION['SHOPPING_CART'] = array(); }

//Add an item only if we have the threee required pices of information: name, price, qty
if (isset($_POST['store_name']) && isset($_POST['price']) && isset($_POST['qty'])&& isset($_POST['unit_drug'])){
	//Adding an Item
	//Store it in a Array
	$ITEM = array(
		//Item name		
		'store_name' => $_POST['store_name'],
		//Product id		
		'store_id' => $_POST['store_id'],
		//Item Price
		'price' => $_POST['price'], 
		
		//Qty wanted of item
		'qty' => $_POST['qty'],
		'unit_drug' => $_POST['unit_drug']	

		);

	//Add this item to the shopping cart
	$_SESSION['SHOPPING_CART'][] =  $ITEM;
	//Clear the URL variables
	//header('Location: ' . $_SERVER['PHP_SELF']);
}
//Allowing the modification of individual items no longer keeps this a simple shopping cart.
//We only support emptying and removing
else if (isset($_GET['remove'])){
	//Remove the item from the cart
	unset($_SESSION['SHOPPING_CART'][$_GET['remove']]);
	//Re-organize the cart
	//array_unshift ($_SESSION['SHOPPING_CART'], array_shift ($_SESSION['SHOPPING_CART']));
	//Clear the URL variables
	header('Location: ' . $_SERVER['PHP_SELF']);
}
else if (isset($_GET['empty'])){
	//Clear Cart by destroying all the data in the session
	session_destroy();
	//Clear the URL variables
	header('Location: ' . $_SERVER['PHP_SELF']);

}
else if (isset($_POST['update'])) {
	//Updates Qty for all items
	foreach ($_POST['items_qty'] as $itemID => $qty) {
		//If the Qty is "0" remove it from the cart
		if ($qty == 0) {
			//Remove it from the cart
			unset($_SESSION['SHOPPING_CART'][$itemID]);
		}
		else if($qty >= 1) {
			//Update to the new Qty
			$_SESSION['SHOPPING_CART'][$itemID]['qty'] = $qty;
		}
	}
	//Clear the POST variables
	header('Location: ' . $_SERVER['PHP_SELF']);
} 

?>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<title></title>
<script Language="Javascript">
<!--
function Conf(object) {
              if (confirm("โปรดยืนยันการจ่ายยา ?") == true) {
          return true;
                }
          return false;
                }
//-->
</script>
<style>
BODY {
	FONT-FAMILY: Arial, Helvetica, sans-serif;
	background-image: url();
	text-decoration: blink;
	background-color: #93EAFF;
}
a:link {
	color: #6600FF;
	text-decoration: none;
}
.style7 {
	color: #FFFFFF;
	font-weight: bold;
	font-size: large;
}
.style9 {
	color: #FF0000;
	font-weight: bold;
	font-family: AngsanaUPC;
	font-size: 22px;
}
.style46 {	color: #333333;
	font-weight: bold;
}
.style47 {color: #0000FF}
.style48 {
	font-family: AngsanaUPC;
	font-size: 22px;
}
.style52 {color: #000000; font-weight: bold; font-family: AngsanaUPC; font-size: 22px; }
.style56 {
	font-family: AngsanaUPC;
	color: #000000;
	font-size: 36px;
}
.style58 {color: #0000FF; font-family: AngsanaUPC; font-size: 22px; }
.style59 {color: #FFFFFF; font-weight: bold; font-family: AngsanaUPC; font-size: 22px; }
.style18 {font-family: AngsanaUPC;
	color: #0000FF;
	font-size: 20px;
}
.style60 {font-family: AngsanaUPC; font-size: 20px; }
.style54 {	font-family: AngsanaUPC;
	font-weight: bold;
	font-size: 22px;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
</style>
<body>
<center>
<span class="style7"><span class="style56">แสดงรายการจ่ายยา</span></span><br>
<br>
<br>
<div id="shoppingCartDisplay">
  <form action="" method="post" name="shoppingcart">
    <?php 
  ob_start();
	mysql_db_query($db,"SET NAMES tis620");
    ?>

    </span>
    <table width="873" border="5" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" style="border-collapse: collapse; border ">
      <tr>
        <th width="339" background="../image/top.jpg" bgcolor="#00CCFF" style="border: 1px dotted #008000" scope="col"> <span class="style58">ชื่อยา</span></th>
        <th width="151" background="../image/top.jpg" bgcolor="#00CCFF" style="border: 1px dotted #008000" scope="col"> <span class="style58">ราคาต่อหน่วย</span></th>
        <th width="159" background="../image/top.jpg" bgcolor="#00CCFF" style="border: 1px dotted #008000" scope="col"> <center class="style58">
            <span class="style58">จำนวน/หน่วยยา            </span>
        </center></th>
        <th width="156" background="../image/top.jpg" bgcolor="#00CCFF" style="border: 1px dotted #008000" scope="col"> <center class="style58">
            <span class="style58">รวม</span>
        </center></th>
        <th width="48" background="../image/top.jpg" bgcolor="#00CCFF" style="border: 1px dotted #008000" scope="col"> <center class="style58">
            <span class="style58">ลบ</span>
        </center></th>
      </tr>
      <?php 
        $_SESSION['total'] = 0;
        //Print all the items in the shopping cart
        foreach ($_SESSION['SHOPPING_CART'] as $itemNumber => $item) {
        ?>
      <tr id="item<?php echo $itemNumber; ?>">
        <td bgcolor="#FFFFCC" style="border: 1px dotted #008000"><center class="style52">
          <?php echo $item['store_name']; ?>
        </center></td>
        <td style="border: 1px dotted #008000" bgcolor="#FFFFCC"><center class="style52"><?php echo number_format($item['price'],2,'.',','); ?></center></td>
        <td style="border: 1px dotted #008000" bgcolor="#FFFFCC"><center class="style52">
          <?php echo $item['qty']; ?>  <?php echo $item['unit_drug']; ?>
        </center></td>
        <td bgcolor="#FFFFCC" style="border: 1px dotted #008000"><center class="style52"><?php echo number_format($item['qty'] * $item['price'],2,'.',','); ?></center></td>
        <td bgcolor="#FFFFCC" style="border: 1px dotted #008000"><center class="style59">
            <a href="?remove=<?php echo $itemNumber; ?>" class="style58">[ลบ]</a>
        </center></td>
      </tr>
      <?php
        $_SESSION['total'] += $item['qty'] * $item['price'];
        }
        ?>
      <tr id="itemtotal">
        <td style="border: 1px dotted #008000" bgcolor="#dcf9ff" colspan="2" align="left"><div align="right"><span class="style52">&nbsp;&nbsp;ราคารวม&nbsp;</span></div></td>
        <td style="border: 1px dotted #008000" bgcolor="#dcf9ff" colspan="3"><p align="center" class="style52"><? echo number_format($_SESSION['total'],2,'.',','); ?>&nbsp;&nbsp;บาท</td>
      </tr>
      <tr id="vat">
        <td style="border: 1px dotted #008000" bgcolor="#dcf9ff" colspan="2" align="left"><div align="right"><span class="style52">&nbsp;&nbsp;ภาษีมูลค่าเพิ่ม (7%)&nbsp;</span></div></td>
        <td style="border: 1px dotted #008000" bgcolor="#dcf9ff" colspan="3"><p align="center" class="style52"><? echo number_format(0.07*$_SESSION['total'],2,'.',','); ?>&nbsp;&nbsp;บาท</td>
      </tr>
      <tr id="total">
        <td style="border: 1px dotted #008000" bgcolor="#dcf9ff" colspan="2" align="left"><div align="right"><span class="style52">&nbsp;&nbsp;ราคารวมทั้งสิ้น&nbsp;</span></div></td>
        <td style="border: 1px dotted #008000" bgcolor="#dcf9ff" colspan="3"><p align="center" class="style9"><? echo number_format((0.07*$_SESSION['total'])+$_SESSION['total'],2,'.',','); ?>&nbsp;&nbsp;บาท</td>
      </tr>
      <tr id="total">
        <td colspan="5" align="left" background="../image/foot.jpg" style="border: 1px dotted #008000"><div align="center" class="style47 style48">[<span class="style47"><a href="javascript:window.close();">กลับไปเพิ่มยา</a>] - [<a href="?empty">ลบยาทุกรายการ</a>] - [<a href="confirm_order.php?preseway_id=<? echo $preseway_id; ?>" target="_blank" onClick="return Conf(this)" ?empty >ยืนยันการจ่ายยา</a>]</span></div></td>
      </tr>
    </table>
    <?php $_SESSION['SHOPPING_CART_HTML'] = ob_get_flush(); ?>
    <p>
      <label></label>
      &nbsp;
<input name="button" type=button
onClick="javascript:window.close();" value="ปิดหน้าต่างนี้">
    </p>
  </form>
</div>
<p>&nbsp;</p>
</center>

</body>
</html> </p>
</body>
</html>




Tag : PHP, MySQL







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-04-30 09:58:59 By : 34 View : 1026 Reply : 12
 

 

No. 1

Guest


Code (PHP)
<?php
ob_start();
?>

ไว้บนสุด ช่วยได้รึป่าวครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-04-30 10:18:07 By : rootElement@kmutnb
 


 

No. 2

Guest


error หายแล้วคะ แต่ พอคลิกยืนยังแล้ว ชื่อคนไข้ไม่มาคะ อีกอย่างตัดสต๊อกยาก็ยังผิดพลาด
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-04-30 10:45:22 By : 34
 

 

No. 3

Guest


ยืนยันบรรทัดไหนอ่า

เช็คพวกการส่งค่าก่อนว่ามันส่งได้ไหม
ใช้ form ส่ง ผ่าน GET หรือ POST ?
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-04-30 11:14:13 By : rootElement@kmutnb
 


 

No. 4

Guest


บรรทัด 345 คะ ส่งแบบPOST คะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-04-30 11:45:17 By : 34
 


 

No. 5

Guest


345 มันเป็นลิ้งไม่ใช่หรอครับ คือคลิกที่ลิ้งแล้วก็ทำงานใช่ไหม
แบบนี้มันคือ GET ค่ามันจะส่งไปพร้อมกับ URL
ส่วนค่าที่อยู่ใน form จะส่งไปได้ก็ต่อเมื่อมีปุ่ม submit นะครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-04-30 13:07:08 By : rootElement@kmutnb
 


 

No. 6

Guest


คะ มันเป็นลิงค์ส่งไปคะ ตรงนี้คะ<a href="confirm_order.php?preseway_id=<? echo $preseway_id; ?>" target="_blank" onClick="return Conf(this)" ?empty >ยืนยันการจ่ายยา</a>]</span></div></td> มันจะไปหน้าใบเสร็จ ปกติมันจะขึ้นชื่อด้วย แต่นี้มันไม่ขึ้นคะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-04-30 13:45:17 By : 34
 


 

No. 7

Guest


ไปหน้า confirm_order.php
โดยส่งค่า preseway_id ไปทาง method GET ผ่านทาง URL
ใช่ไหมครับ

ถ้าใช่ ก็ต้องเอา preseway_id ไปทำงานต่อครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-04-30 14:10:37 By : rootElement@kmutnb
 


 

No. 8

Guest


คะ มันมาแบบนี้ http://localhost/clinicsystem/pay/confirm_order.php?preseway_id=

จริงๆควรมาแบบนี้http://localhost/clinicsystem/pay/confirm_order.php?preseway_id=550001

preseway_id= มันไม่ยอมมา ทำไงดีคะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-04-30 14:28:02 By : 34
 


 

No. 9

Guest


รู้สึกว่า ว่าเอา preseway_id ไปทำงานแล้วนะคะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-04-30 15:43:07 By : 34
 


 

No. 10

Guest


แงๆๆ ใครพอช่วยได้ไหมคะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-04-30 17:09:27 By : 34
 


 

No. 11

Guest


ดันกระทู้ ช่วยหน่อยคะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-05-01 08:44:25 By : 34
 


 

No. 12

Guest


ไม่มีใครช่วยเลยหรอคะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-05-01 15:02:32 By : 34
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : เวลาคลิกลบมันขึ้น error Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\clinicsystem\pay\order.php:6) in C:\AppServ\www\clinicsystem\pay\order.php on line 190
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่