<?php
// sprawdzamy, czy zmienna $submit jest pusta
if (empty($_POST['submit'])) { ?>
<html>
<head>
<title>Ankieta</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table id="Table_01" width="888" height="450" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td colspan="5">
<img src="images/questionnaire_01a.gif" width="888" height="119" alt=""></td>
</tr>
<tr>
<td background="images/questionnaire_02.gif">
</td>
<td colspan="2" bgcolor="#ffffff" width="792"><div style="margin-left:10px; margin-right:10px;">
<p>
<?php
$_SESSION['blad'] = "";
?>
</p>
<form method="post">
<p>1.1 Gender </p>
<label>
<input type="radio" name="Plec" value="Male" />
Male</label>
<br />
<label>
<input type="radio" name="Plec" value="Female" />
Female</label>
<p>1.2 Age </p>
<label>
<input type="radio" name="Wiek" value="15-24" />
15-24</label>
<br />
<label>
<input type="radio" name="Wiek" value="25-34" />
25-34</label>
<br />
<label>
<input type="radio" name="Wiek" value="35-44" />
35-44</label>
<br />
<label>
<input type="radio" name="Wiek" value="45-54" />
45-54</label>
<br />
<label>
<input type="radio" name="Wiek" value="55-64" />
55-64</label>
<br />
<label>
<input type="radio" name="Wiek" value="65+" />
64+</label>
<p>1.3 How long have you used the Internet?</p>
<label>
<input type="radio" name="RadioGroup" value="Less than 3 Months" />
Less than 3 Months</label>
<br />
<label>
<input type="radio" name="RadioGroup" value="3 Months to 6 Months" />
3 Months to 6 Months</label>
<br />
<label>
<input type="radio" name="RadioGroup" value="6 Months to 1 Year" />
6 Months to 1 Year</label>
<br />
<label>
<input type="radio" name="RadioGroup" value="1 to 2 Years" />
1 to 2 Years</label>
<br />
<label>
<input type="radio" name="RadioGroup" value="More than 2 Years" />
More than 2 Years</label>
<p>1.4 Where do you access the internet? (tick all answers that are true in your case)</p>
<p><label><input name="checkbox1[]" type="checkbox" value="Home"/>Home </label><br />
<label><input name="checkbox1[]" type="checkbox" value="Office"/>Office </label><br />
<label><input name="checkbox1[]" type="checkbox" value="University"/>University </label><br />
<label><input name="checkbox1[]" type="checkbox" value="Internet Café"/>Internet Café </label><br />
<label><input name="checkbox1[]" type="checkbox" value="Other"/>Other</label><br />
</p>
<p>1.5 For what purposes do you use the internet? (tick all answers that are true in your case)</p>
<p><label><input name="checkbox2[]" type="checkbox" value="Communication"/>Communication </label><br />
<label><input name="checkbox2[]" type="checkbox" value="Education"/>Education </label><br />
<label><input name="checkbox2[]" type="checkbox" value="Games"/>Games </label><br />
<label><input name="checkbox2[]" type="checkbox" value="Information"/>Information </label><br />
<label><input name="checkbox2[]" type="checkbox" value="Internet banking"/>Internet banking</label><br />
<label><input name="checkbox2[]" type="checkbox" value="Online shopping"/>Online shopping</label><br />
<label><input name="checkbox2[]" type="checkbox" value="Watch TV / Listen to Music"/>Watch TV / Listen to Music</label><br />
<label><input name="checkbox2[]" type="checkbox" value="Work"/>Work</label><br />
<label><input name="checkbox2[]" type="checkbox" value="Other"/>Other </label><input name="checkbox2[]" /><br />
<p>1.6 On what level you assume your computer skills are?</p>
<label>
<input type="radio" name="RadioGroup2" value="Basic" />
Basic</label>
<br />
<label>
<input type="radio" name="RadioGroup2" value="Intermediate" />
Intermediate</label>
<br />
<label>
<input type="radio" name="RadioGroup2" value="Advanced" />
Advanced</label>
<br />
<p>1.7 How familiar you are with using the internet?</p>
<label>
<input type="radio" name="RadioGroup3" value="Little" />
Little
</label>
<br />
<label>
<input type="radio" name="RadioGroup3" value="Quite" />
Quite
</label>
<br />
<label>
<input type="radio" name="RadioGroup3" value="Very" />
Very
</label>
</p>
</div>
</td>
<td colspan="2" background="images/questionnaire_04.gif">
</td>
</tr>
<tr>
<td colspan="5">
<img src="images/questionnaire_05.gif" width="888" height="40" alt=""></td>
</tr>
<tr>
<td colspan="2" rowspan="2">
<img src="images/questionnaire_06.gif" width="735" height="70" alt=""></td>
<td colspan="2">
<input type="image" name="submit" src="images/questionnaire_07.gif" value="Wyslij"/></form></td>
<td rowspan="2">
<img src="images/questionnaire_08.gif" width="33" height="70" alt=""></td>
</tr>
<tr>
<td colspan="2">
<img src="images/questionnaire_09.gif" width="120" height="27" alt=""></td>
</tr>
<tr>
<td>
<img src="images/spacer.gif" width="48" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="687" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="105" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="15" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="33" height="1" alt=""></td>
</tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>
<?php
} elseif (!empty($_POST['Plec']) && !empty($_POST['Wiek']) && !empty($_POST['RadioGroup'])) { // sprawdzamy, czy zmienne przesane z formularza nie są puste
// jeżeli poy tworzona jest wiadomość
// zmienna $message zawiera treść wiadomosci
$message = "n1.1 {$_POST['Plec']}
n1.2 {$_POST['Wiek']}
n1.3 {$_POST['RadioGroup']}
n1.4 ";
foreach ($_POST['checkbox1'] as $val) {
$message .= "n - $val ";
}
$message .= "n1.5 ";
foreach ($_POST['checkbox2'] as $val) {
$message .= "n - $val ";
}
$message .= "n1.6 {$_POST['RadioGroup2']}
n1.7 {$_POST['RadioGroup3']}";
// zmienna $header zawiera przede wszystkim adres zwrotny
$header = "From: Ankieta";
// funkcja mail() za pomocą której wiadomość zostanie wysłana
@mail("arti@loveless.pl","Ankieta 1/5 $_SERVER[ 'REMOTE_ADDR' ] ","$message","$header") or
die('Nie udało się wysłać wiadomości');
if ($_POST['RadioGroup'] == '3 Months to 6 Months') {
header('Location: questionnaire2.php'); } else {
header('Location: questionnaire2.php'); }
// wywietlenie komunikatu w przypadku powodzenia
} else {
$_SESSION['blad'] = "<span style="color: #FF0000; text-align: center;">Wypelnij wszystkie pola formularza!</span>";
header('Location: questionnaire1.php'); }
?>