|
|
|
เกี่ยวกับวันที่ใน php ครับ จะแสดงได้ยังไง ถ้าเป็นแบบนี้ |
|
|
|
|
|
|
|
แก้โค้ดครับ
Code (PHP)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Funny park</title>
</head>
<body>
<?
$date = $_POST[buy_date];
$time = $_POST[buy_time];
$man = $_POST[man];
$kid = $_POST[kid];
$d = date("N");
if($d == 1 || 2 || 3 || 4 || 5)
{
$totalman = $man*250;
$totalkid = $kid*150;
}elseif($d == 6 || 7)
{
if($time == morning)
{
$totalman = $man*300;
$totalkid = $kid*170;
}elseif($time == Midday)
{
$totalman = $man*350;
$totalkid = $kid*200;
}elseif($time == Evening)
{
$totalman = $man*450;
$totalkid = $kid*250;
}
}
$totalprice = $totalkid + $totalman;
echo "<h3>Funny park ticket online</h3><br>";
echo "วันที่ซื้อบัตร : $date <br>";
echo "เวลาที่ซื้อบัตร : $time น.<br>";
echo "บัตรผู้ใหญ่ : $totalman (จำนวน $man ใบ) <br>";
echo "บัตรเด็ก : $totalkid (จำนวน $kid ใบ) <br>";
echo "รวมเงิน $totalprice";
?>
</body>
</html>
|
|
|
|
|
Date :
2012-11-19 21:22:50 |
By :
aragod006 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Funny park</title>
</head>
<body>
<?
$date_buy = $_POST[buy_date];
$time_buy = $_POST[buy_time];
$man = $_POST[man];
$kid = $_POST[kid];
$d = date("N",$date_buy);
if($d == 1 || 2 || 3 || 4 || 5)
{
$totalman = $man*250;
$totalkid = $kid*150;
}elseif($d == 6 || 7)
{
if($time == morning)
{
$totalman = $man*300;
$totalkid = $kid*170;
}elseif($time == Midday)
{
$totalman = $man*350;
$totalkid = $kid*200;
}elseif($time == Evening)
{
$totalman = $man*450;
$totalkid = $kid*250;
}
}
$totalprice = $totalkid + $totalman;
echo "<h3>Funny park ticket online</h3><br>";
echo "วันที่ซื้อบัตร : $date <br>";
echo "เวลาที่ซื้อบัตร : $time น.<br>";
echo "บัตรผู้ใหญ่ : $totalman (จำนวน $man ใบ) <br>";
echo "บัตรเด็ก : $totalkid (จำนวน $kid ใบ) <br>";
echo "รวมเงิน $totalprice";
?>
</body>
</html>
ลองแบบนี้ดูครับ
|
|
|
|
|
Date :
2012-11-20 09:10:34 |
By :
GhostLocal |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณครับ
|
|
|
|
|
Date :
2012-12-01 21:20:32 |
By :
aragod006 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อีกหนึ่งทางเลือก
<?php
echo date("d")." ";
echo date("m")." ";
echo date("Y")." ";
echo date("h:i:s A");
ECHO ' <br/>';
echo jddayofweek ( cal_to_jd(CAL_GREGORIAN, date("m"),date("d"), date("Y")) , 1 );
?>
|
|
|
|
|
Date :
2012-12-01 22:04:34 |
By :
sakuraei |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|