четверг, 1 марта 2012 г.

<table border="1"><?

<!DOCTYPE html>
<?
$questions = array ('jQuery ???' => 
array ('programming language',
  'tehnology',
  'helper',
  'library'),
'??? ?????????? ???????? ????? ?' => 
array ('????',
    '??????',
  '???????',
  '?.???????'),
'Vopros 3 ? ' => 
array ('Otvet 1',
    'Otvet 2',
  'Otvet 3',
  'Otvet 4')
);
if(isset($_GET['vopros']) && isset($_GET['otvet']))
{
$vopros = $_GET['vopros'];
$otvet = $_GET['otvet'];
$correct = $vopros."_".$otvet;
switch($correct)
{
case '1_d': echo "Otvet '$otvet' vernij"; break;
case '2_c': echo "Otvet '$otvet' vernij"; break;
case '3_b': echo "Otvet '$otvet' vernij"; break;
default: echo "Otvet  '$otvet' ne vernij";
}
}
?>
<html>
<head>
<title>Task Optimization</title>
<meta charset="utf-8"/>
</head>
<body>

<table border="1"><?
$first_ques = 1;
foreach($questions as $question => $answers)
{
$answ_opt = 'a';
?><tr><td colspan="2" width="950px"><?=$question?></td></tr><?
foreach($answers as $answer)
{
?><tr>
<th width="50px">
<a href="?vopros=<?=$first_ques?>&otvet=<?=$answ_opt?>"><?=$answ_opt?></a>
</th>
<td><?=$answer?></td>
</tr><?
$answ_opt ++;
}
$first_ques ++;
}
?></table>
</body>
</html>

Комментариев нет:

Отправить комментарий