This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu<form method="POST" action="cart.php">
<input type="text" name="product_name" placeholder="ชื่อสินค้า"><br>
<input type="number" name="quantity" placeholder="จำนวนสินค้า"><br>
<input type="submit" value="เพิ่มสินค้า">
</form>
session_start();
if(!isset($_SESSION['cart'])) {
$_SESSION['cart'] = array();
}
if(isset($_POST['product_name']) && isset($_POST['quantity'])) {
$product_name = $_POST['product_name'];
$quantity = $_POST['quantity'];
$product = array('name' => $product_name, 'quantity' => $quantity);
array_push($_SESSION['cart'], $product);
}
session_start();
if(isset($_SESSION['cart'])) {
foreach($_SESSION['cart'] as $product) {
echo $product['name'] . ' (' . $product['quantity'] . ')<br>';
}
} else {
echo 'ไม่มีสินค้าในตะกร้า';
}
Scanner scanner = new Scanner(System.in);
System.out.print("ป้อนวันเกิดของคุณ (dd/mm/yyyy): ");
String dateOfBirthString = scanner.next();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date dateOfBirth = sdf.parse(dateOfBirthString);
Calendar cal = Calendar.getInstance();
cal.setTime(dateOfBirth);
int yearOfBirth = cal.get(Calendar.YEAR);
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
int age = currentYear - yearOfBirth;
System.out.println("อายุของคุณคือ: " + age + " ปี");
System.out.println("อายุของคุณคือ: " + age + " ปี");
var name: String = "John"
var age: Int = 25
var height: Double = 1.75
var name: String = "John"
name = "Jane"
var name: String = "John"
var age: Int = 25
var height: Double = 1.75
var isStudent: Boolean = true
fun main(args: Array<String>) {
var name: String = "John"
var age: Int = 25
var height: Double = 1.75
println("My name is " + name)
println("I am " + age + " years old")
println("My height is " + height)
}
x = 3
y = 5
z = x + y
print(z)
x = 10
y = 7
z = x - y
print(z)
x = 6
y = 4
z = x * y
print(z)
x = 10
y = 2
z = x / y
print(z)
x = 7
y = 3
z = x % y
print(z)