· 7 years ago · Dec 11, 2018, 10:34 AM
1<!doctype html>
2<html>
3 <head>
4 <meta charset="UTF-8" />
5 <META name=â€description†content="We are a specialist store and offer professional skates and accessories. Find your perfect skates model in our wide range.">
6 <meta name=â€keywords†content="skates, physical activity, accessories, protectors, arms, back, legs, hands, safety on skates">
7 <meta name=â€author†content="Filip Mijalski and Iwona Wojtaszek">
8 <link rel="icon" type="image/x-icon" href="img/logo.png">
9 <title>Order form</title>
10 <link rel="stylesheet" href="css/formStyle.css" type="text/css" />
11 <style type="text/css">
12 body {
13 background-image: url("img/logo.png");
14 background-repeat: no-repeat;
15 background-color: #fff7e6;
16 background-attachment: fixed;
17 background-position: right top;
18 }
19 </style>
20 </head>
21 <body>
22 <header>
23 <h1 class="titleText">CzadRolki</h1>
24 <nav>
25 <h2>Menu</h2>
26 <ul>
27 <li><a href="index.html">Home</a></li>
28 <li><a href="contact.html">Contact</a></li>
29 <li><a href="sizetable.html">Size Chart</a></li>
30 </ul>
31 </nav>
32 </header>
33
34 <h1>ROLKI FITNESS FIT 3 OXELO</h1>
35 <a href="product.html"><img src="img/rolki1.jpg" width="80" height="80" alt="Rolki OXELO"></a> ←Click to get back
36 <h2>199.99 zł</h2>
37 <br>
38
39 <?php
40 define('IWONA', "Iwona Wojtaszek");
41 define('FILIP', "Filip Mijalski");
42 $surnameErr = $emailErr = "";
43 $surname = $email = $comment = "";
44 $valid_emails = array("@interia.pl", "@gmail.com", "@onet.pl");
45 $valid_emails_string = "";
46 $count = 0;
47 $extras = array("SoleShields" => FALSE, "RollWrenches" => FALSE, "Screws" => FALSE, "RollerWheels" => FALSE);
48 if ($_SERVER["REQUEST_METHOD"] == "POST") {
49 if (empty($_POST["surname"])) {
50 $surnameErr = "Nazwisko jest wymagane.";
51 $count = $count + 1;
52 } else {
53 if (strcasecmp($_POST["surname"], 'Iwona' ) == 0)
54 {
55 $surname = "Cześć " . IWONA;
56 }elseif ($_POST["surname"] === 'Filip'){
57 $surname = "Cześć " . FILIP;
58 }elseif(strcmp($_POST["surname"], 'DIE' ) == 0){
59 die("\n O NIE, COÅš POSZÅO NIE TAK, SPRÓBUJ PÓŹNIEJ");
60 }
61 else{
62 $surname = check_security($_POST["surname"]);
63 }
64 }
65 if (empty($_POST["email"])) {
66 $emailErr = "Email jest wymagany.";
67 $count++;
68 } else {
69 $email = check_security($_POST["email"]);
70 if(preg_match("/@student.pwr.edu.pl/",$email)){
71 for ($i = 0; $i < count($valid_emails); $i++){
72 $valid_emails_string = $valid_emails_string . ", " . preg_replace("/@student.pwr.edu.pl/",$valid_emails[$i],$email);
73 }
74 $emailErr = "Niestety ten adres e-mail nie jest akceptowany. Lecz np. adresy " . $valid_emails_string . " Byłyby poprawne." ;
75 $count++;
76 }
77 }
78 if ($count == 1) {
79 $comment = "Jeszcze jedno wymagane \"pole\" jest nie uzupełnione";
80 } elseif($count > 1) {
81 $comment = "Jeszcze dwa wymagane \"pola\" są nie uzupełnione";
82 } elseif ($count < 1) {
83 $comment = "Dziękuję za wszystkie wymagene dane";
84 }
85 foreach($extras as $x => $x_value) {
86 $extras[$x] = isset($_POST[$x]);
87 }
88 }
89
90 function check_security($data) {
91 $data = addslashes($data);
92 return $data;
93 }
94 ?>
95
96 <h2>The order form</h2>
97 <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" autocomplete="on">
98 <p>
99 <input id="name" name="name" type="text" size="25" placeholder="Your name" autofocus>
100 </p>
101
102 <p>
103 <span id="warning">* <?php echo $surnameErr;?></span><br>
104 <input id="surname" name="surname" type="text" size="25" placeholder="Your surname">
105 </p>
106 <p>
107 <span id="warning">* <?php echo $emailErr;?></span><br>
108 <input id="email" name="email" type="email" placeholder="Your email">
109 <label for="email">Format: name@server.domain</label>
110 </p>
111 <p>
112 <input id="phone" type="tel" pattern="[0-9]{3}-[0-9]{3}-[0-9]{3}" placeholder="Your phone number">
113 <label for="phone">Format: 123-456-789</label>
114 </p>
115
116 <p><label>Month of Birth:<br>
117 <input name="Birth month" list="months" size="25"> Your month of birth
118 <datalist id="months">
119 <option value="January">
120 <option value="February">
121 <option value="March">
122 <option value="April">
123 <option value="May">
124 <option value="June">
125 <option value="July">
126 <option value="August">
127 <option value="September">
128 <option value="October">
129 <option value="November">
130 <option value="December">
131 </datalist>
132 </label></p>
133
134 <p><label> Size:
135 <select name="Size">
136 <optgroup label="Small">
137 <option>34</option>
138 <option>35</option>
139 <option>36</option>
140 </optgroup>
141 <optgroup label="Medium">
142 <option>36,5</option>
143 <option>37</option>
144 <option>38</option>
145 </optgroup>
146 <optgroup label="Large">
147 <option>38,5</option>
148 <option>39</option>
149 <option>40</option>
150 </optgroup>
151 </select>
152 </label></p>
153
154 <a target="_blank" href="sizetable.html">
155 <h4>Size Chart</h4>
156 <h1></h1>
157 </a>
158
159 <p> Gender:
160 <label><input type="radio" name="gender" id="Woman"> Woman</label>
161 <label><input type="radio" name="gender" id="Man"> Man</label>
162 </p>
163
164 <p>
165 <label><input type="checkbox" class="checkExtra" name="SoleShields"> Sole Shields</label>
166 <label><input type="checkbox" class="checkExtra" name="RollWrenches"> Roll Wrenches</label>
167 <label><input type="checkbox" class="checkExtra" name="Screws"> Screws</label>
168 <label><input type="checkbox" class="checkExtra" name="RollerWheels"> Roller Wheels</label>
169 </p>
170
171 <p><label>Your message to the seller:<br></label>
172 <textarea name = "comments" rows = "5" cols = "25" maxlength="200" disabled="disabled"></textarea>
173 </p>
174
175 <p id="buttons">
176 <span id="warning"><?php echo $comment;?></span><br>
177 <input type = "submit" value = "Submit" id="submitOrderForm">
178 <input type = "reset" value = "Clear" id="clear"><br>
179 <span id="warning2">
180 <?php
181 echo "extras: ";
182 while (key($extras)!=NULL) {
183 if (current($extras) == TRUE) {
184 echo key($extras).', ';
185 }
186 next($extras);
187 }
188 reset($extras);
189 echo "<br>";
190 echo $email;
191 echo "<br>";
192 echo $surname;
193 echo "<br>";
194 echo $_SERVER['SERVER_ADDR'];
195 echo "<br>";
196 echo $_SERVER['SCRIPT_FILENAME'];
197 ?>
198 </span><br>
199 </p>
200 </form>
201 </body>
202</html>