html head head body form method GET action _SERVER PHP_SELF Введите ru

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<html>
<head>
</head>
<body>
<form method="GET" action="<?=$_SERVER['PHP_SELF']?>">
<p>Введите ru/eng</p>
<input type="text" name="lang">
<input type="submit">
<p>Введите день недели (1-7)</p>
<input type="text" name="day">
<input type="submit">
</form>
</body>
</html>
<?php
$mas = array(
'ru' => array(
"1"=>"Понедельник",
"2"=>"Вторник",
"3"=>"Среда",
"4"=>"Четверг",
"5"=>"Пятница",
"6"=>"Суббота",
"7"=>"Воскресенье"
),
'eng' => array(
"1"=>"Monday",
"2"=>"Tuesday",
"3"=>"Wednesday",
"4"=>"Thursday",
"5"=>"Friday",
"6"=>"Saturday",
"7"=>"Sunday"
),
);
if (!empty($_GET['lang']) && !empty($_GET['day'])) {
$lang = $_GET["lang"];
$day = $_GET["day"];
echo $mas[$lang]["$day"];
}