Auswertung Formular

  • PHP

  • Don Johnson
  • 1171 Aufrufe 4 Antworten

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Auswertung Formular

    Hallo leute hab emal ne auswertung für erin Formualr geschriebne !

    Wie findet ihr es ?
    Über verbserrungs Vrschläge würde ich mich freuen!!

    PHP-Quellcode

    1. <html>
    2. <head>
    3. <title>Auswertung im Formular</title>
    4. <meta name="author" content="daniel">
    5. <meta name="generator" content="Ulli Meybohms HTML EDITOR">
    6. </head>
    7. <body text="#0000FF" bgcolor="#C0C0C0">
    8. <?php
    9. $name = $_GET['name'];
    10. $vorname = $_GET['vorname'];
    11. $geschlecht = $_GET['geschlecht'];
    12. $hausnummer = $_GET['hausnummer'];
    13. $post = $_GET['post'];
    14. $anrede = $_GET['anrede'];
    15. $passwort = $_GET['passwort'];
    16. $passwortw = $_GET['passwortw'];
    17. $wohnort = $_GET['wohnort'];
    18. $land = $_GET['land'];
    19. $tag = $_GET['tag'];
    20. $monat = $_GET['monat'];
    21. $jahr = $_GET['jahr'];
    22. $email = $_GET['email'];
    23. $emailw = $_GET['emailw'];
    24. $strasse = $_GET['strasse'];
    25. $bundesland = $_GET['bundesland'];
    26. $herkunft = $_GET['herkunft'];
    27. $alter = $_GET['alter'];
    28. $groesse = $_GET['groesse'];
    29. $haare = $_GET['haare'];
    30. $augen = $_GET['augen'];
    31. $geschlecht1 = $_GET['geschlecht1'];
    32. //MUSTER ZUR ÜBERPRÜFUNG DER EINGABEN!!!!!!
    33. $emailmuster = "^[_a-zA-Z0-9-](\.{0,1}[_a-zA-Z0-9-])*@([a-zA-Z0-9-]{2,}\.){0,}[a-zA-Z0-9-]{3,}(\.[a-zA-Z]{2,4}){1,2}$";
    34. //MUSTER LÄSST BUCHSTABEN VON a-z , A-Z ZU UND SCHLIEßT ZAHlEN UND DIESE SONDERZEICHEN AUS 0-9@§$%&/()=?´`+*~#'-_:;,\.<>|^° AUßERDEM MÜSSEN MINDESTENS 2 BUCHSTABEN EINGEBEB WORDEN SEIN!!!
    35. $muster = "^[a-zA-Z][^0-9@§$%&/()=?ß+*~#'-_:;,\.<>|^°]{2,}$";
    36. //MUSTER LÄSST BUCHSTABEN VON a-z , A-Z ZU UND SCHLIEßT ZAHlEN UND DIESE SONDERZEICHEN AUS 0-9@§$%&/()=?´`+*~#'_:;,\.<>|^° AUßERDEM MÜSSEN MINDESTENS 2 BUCHSTABEN EINGEBEB WORDEN SEIN!!!
    37. $muster1 = "^[a-zA-Z][^0-9@§$%&/()=?´`+*~#'_:;,\.<>|^°]{2,}$";
    38. //MUSTERPLZ LÄSST ZAHLEN VON 0-9 ZU UND SCHLIEßT AllE BUCHSTABEN a-z , A-Z UND DIESE SONDERZEICHEN AUS a-zA-Z@§$%&/()=?´`+*~#'-_:;,\.<>|^° AUSSERDEM MÜSSEN GENAU 5 ZAHLEN EINGEBEN WORDEN SEIN!!!
    39. $musterplz = "^[0-9]{5}$";
    40. //MSUTERHAUS LÄSST ZAHLEN von 0-9 ZU UND ES MUSS MINDESTENS EINE ZAHL EIGEBEN WORDEN SEIN!!!
    41. $musterhaus = "^[0-9]{2,}[a-zA-Z]{2}$";
    42. $mustergroesse = "^[0-2]{1}[,,.][0-9]{2}$";
    43. //MUSTER ENDE
    44. //FUNKTION OBEN ANFANG
    45. function oben () {
    46. global $anrede;
    47. global $geschlecht;
    48. global $tag;
    49. global $monat;
    50. global $jahr;
    51. global $post;
    52. global $hausnummer;
    53. global $vorname;
    54. global $name;
    55. global $wohnort;
    56. global $strasse;
    57. global $land;
    58. global $muster;
    59. global $musterhaus;
    60. //BEGINN AUSWERTUNG
    61. echo'<form action="auswertung.php" method="GET">';
    62. echo'<p><div align="center"><font color="#FF0000" size="+2">Ihre Persönliche Daten:</font><br></p>';
    63. if (ereg($muster, $name)){
    64. echo'<table width="100%">';
    65. echo'<tr>';
    66. echo'<td width="30%">Name:</td>';
    67. echo'<td width="70%"><input type="text" name="name" size="35" maxlength="35" value="'; echo $name; echo'"></input></td>';
    68. echo'</tr>';
    69. echo'</table>';
    70. }else{
    71. echo'<div align="center"><font color="#FF0000">Bitte überprüfen Sie ihren Eingebenen Namen! Er darf keine Sonderzeichen enthalten!</font></div>';
    72. echo'<table width="100%">';
    73. echo'<tr>';
    74. echo'<td width="30%"><font color="#FF0000">Name:</font></td>';
    75. echo'<td width="70%"><input type="text" name="name" size="15" maxlength="15"></input></td>';
    76. echo'</tr>';
    77. echo'</table>';
    78. }
    79. if (ereg($muster, $vorname)){
    80. echo'<table width="100%">';
    81. echo'<tr>';
    82. echo'<td width="30%">Vorname:</td>';
    83. echo'<td width="70%"><input type="text" name="vorname" size="35" maxlength="35" value="'; echo $vorname; echo'"></input></td>';
    84. echo'</tr>';
    85. echo'</table>';
    86. }else{
    87. echo'<div align="center"><font color="#FF0000">Bitte überprüfen Sie ihren Eingebenen Vornamen! Er darf keine Sonderzeichen enthalten!</font></div>';
    88. echo'<table width="100%">';
    89. echo'<tr>';
    90. echo'<td width="30%"><font color="#FF0000">Vorname:</font></td>';
    91. echo'<td width="70%"><input type="text" name="vorname" size="15" maxlength="15"></input></td>';
    92. echo'</tr>';
    93. echo'</table>';
    94. }
    95. if (ereg($muster, $wohnort)){
    96. echo'<table width="100%">';
    97. echo'<tr>';
    98. echo'<td width="30%">Wohnort:</td>';
    99. echo'<td width="70%"><input type="text" name="wohnort" maxlength="35" value="'; echo $wohnort; echo'">';
    100. echo'</tr>';
    101. echo'</table>';
    102. }else{
    103. echo'<div align="center"><font color="#FF0000">Bitte überprüfen Sie ihren Eingebenen Wohnort! Er darf keine Sonderzeichen enthalten!</font></div>';
    104. echo'<table width="100%">';
    105. echo'<tr>';
    106. echo'<td width="30%"><font color="#FF0000">Wohnort:</font></td>';
    107. echo'<td width="70%"><input type="text" name="wohnort" size="20" maxlength="20"></input></td>';
    108. echo'</tr>';
    109. echo'</table>';
    110. }
    111. if (ereg($muster, $strasse)){
    112. echo'<table width="100%">';
    113. echo'<tr>';
    114. echo'<td width="30%">Straße:</td>';
    115. echo'<td width="70%"><input type="text" name="strasse" maxlength="35" value="'; echo $strasse; echo'">';
    116. echo'</tr>';
    117. echo'</table>';
    118. }else{
    119. echo'<div align="center"><font color="#FF0000">Bitte überprüfen Sie die von ihnen Eingebenen Straße! Sie darf keine Sonderzeichen enthalten!</font></div>';
    120. echo'<table width="100%">';
    121. echo'<tr>';
    122. echo'<td width="30%"><font color="#FF0000">Straße:</font></td>';
    123. echo'<td width="70%"><input type="text" name="strasse" size="25" maxlength="25"></td>';
    124. echo'</tr>';
    125. echo'</table>';
    126. }
    127. if (ereg($muster, $land)){
    128. echo'<table width="100%">';
    129. echo'<tr>';
    130. echo'<td width="30%">Land:</td>';
    131. echo'<td width="70%"><input type="text" name="land" maxlength="35" value="'; echo $land; echo'"></td>';
    132. echo'</tr>';
    133. echo'</table>';
    134. }else{
    135. echo'<div align="center"><font color="#FF0000">Bitte überprüfen Sie dias von Ihnen Eingebene Land! Es darf keine Sonderzeichen enthalten!</font></div>';
    136. echo'<table width="100%">';
    137. echo'<tr>';
    138. echo'<td width="30%"><font color="#FF0000">Land:</td>';
    139. echo'<td width="70%"><input type="text" name="land" size="15" maxlength="15"></input></td>';
    140. echo'</tr>';
    141. echo'</table>';
    142. }
    143. echo'<table width="100%">';
    144. echo'<tr>';
    145. echo'<td>Geschlecht</td>';
    146. echo'<td><select name="geschlecht"><option selected>'; echo $geschlecht; echo'</select></td>';
    147. echo'</tr>';
    148. echo'<tr>';
    149. echo'<td width="30%">Anrede</td>';
    150. echo'<td width="70%"><select name="anrede"><option selected>'; echo $anrede; echo'</select></td>';
    151. echo'</tr>';
    152. echo'<tr>';
    153. echo'<td>Geburtsdatum </td>';
    154. echo'<td><select name="tag">';
    155. echo'<option selected>'; echo $tag; echo'</option>';
    156. echo'</select>';
    157. echo'<select name="monat">';
    158. echo'<option selected>'; echo $monat; echo'</option>';
    159. echo'</select>';
    160. echo'<select name="jahr">';
    161. echo'<option selected>'; echo $jahr; echo'</option>';
    162. echo'</select></td>';
    163. echo'</tr>';
    164. echo'</table>';
    165. if (ereg($musterhaus, $hausnummer)){
    166. echo'<table width="100%">';
    167. echo'<tr>';
    168. echo'<td width="30%">Hausnummer</td>';
    169. echo'<td width="70%"><input type="text" name="hausnummer" maxlength="5" size="4" value="'; echo $hausnummer; echo'"></td>';
    170. echo'</tr>';
    171. echo'</table>';
    172. }else{
    173. echo'<div align="center"><font color="#FF0000">Bitte überprüfen Sie die von Ihnen Eigegebene Hausnummer, sie darf keine Großbuchstaben sowie Sonderzeichen entahlten!!</font></div>';
    174. echo'<table width="100%">';
    175. echo'<tr>';
    176. echo'<td width="30%"><font color="#FF0000">Hausnummer</font></td>';
    177. echo'<td width="70%"><input type="text" name="hausnummer" maxlength="5" size="4"></td>';
    178. echo'</tr>';
    179. echo'</table>';
    180. }
    181. }
    182. //FUNKTION OBEN ENDE
    183. //ANFANG FUNKTION ZAHLEN
    184. function zahlen () {
    185. global $post;
    186. global $musterplz;
    187. if (ereg($musterplz, $post)){
    188. echo'<table width="100%">';
    189. echo'<td width="30%">Postleitzahl</td>';
    190. echo'<td width="70%"><input type="text" name="post" maxlength="5" size="6" value="'; echo $post; echo'">';
    191. echo'</tr>';
    192. echo'</table>';
    193. }else {
    194. echo'<div align="center"><font color="#FF0000">Bitte überprüfen Sie die von Ihnen Eingebenen Postleitzahl! Sie darf keine Sonderzeichen enthalten!</font></div>';
    195. echo'<table width="100%">';
    196. echo'<td width="30%"><font color="#FF0000">Postleitzahl</font></td>';
    197. echo'<td width="70%"><input type="text" name="post" maxlength="5" size="6">';
    198. echo'</tr>';
    199. echo'</table>';
    200. }
    201. }
    202. //ENDEFUNKTION ZAHLEN
    203. //ANFANG FUNKTION PASSWORT
    204. function passwort() {
    205. global $passwort;
    206. global $passwortw;
    207. if ($passwort == $passwortw) {
    208. echo'<table width="100%">';
    209. echo'<tr>';
    210. echo'<td width="30%">Passwort</td>';
    211. echo'<td width="70%"><input type="password" name="passwort" maxlength="35" value="'; echo $passwort; echo'"></td>';
    212. echo'</tr>';
    213. echo'<tr>';
    214. echo'<td>Passwort [Kontrolle]</font></td>';
    215. echo'<td><input type="password" name="passwortw" maxlength="35" value="'; echo $passwortw; echo'"></td>';
    216. echo'</tr>';
    217. echo'</table>';
    218. }else{
    219. echo'<div align="center"><font color="#FF0000">Die Eingegeben Passwörter stimmen nicht überein , bitte geben Sie sie erneut ein !</font></div>';
    220. echo'<table width="100%">';
    221. echo'<tr>';
    222. echo'<td width="30%">Passwort</td>';
    223. echo'<td width="70%"><input type="password" name="passwort" maxlength="35" ></td>';
    224. echo'</tr>';
    225. echo'<tr>';
    226. echo'<td>Passwort <font size="1">(wiederholen)</font></td>';
    227. echo'<td><input type="password" name="passwortw" maxlength="35"></td>';
    228. echo'</tr>';
    229. echo'</table>';
    230. }
    231. }
    232. //ENDE FUNKTION PASSWORT
    233. //BEGINN FUNKTION EMAIL
    234. function email() {
    235. global $email;
    236. global $emailw;
    237. global $emailmuster;
    238. if ($email == $emailw) {
    239. if (ereg($emailmuster, $email)) {
    240. echo'<table width="100%">';
    241. echo'<tr>';
    242. echo'<td width="30%">E-Mail Adresse</td>';
    243. echo'<td width="70%"><input type="text" name="email" maxlength="40" size="40" value="'; echo $email; echo'"></td>';
    244. echo'</tr>';
    245. echo'<tr>';
    246. echo'<td>E-Mail Adresse [Kontrolle]</td>';
    247. echo'<td><input type="text" name="emailw" maxlength="40" size="40" value="'; echo $emailw; echo'"></td>';
    248. echo'</tr>';
    249. echo'</table>';
    250. }else {
    251. echo'<div align="center"><font color="#FF0000">Die von Ihnen Angegebenen E-Mail Adressen sind nicht gültig , bitte geben Sie sie erneut ein!</font></div>';
    252. echo'<table width="100%">';
    253. echo'<tr>';
    254. echo'<td width="30%">E-Mail Adresse</td>';
    255. echo'<td width="70%"><input type="text" name="email" maxlength="40" size="40"></td>';
    256. echo'</tr>';
    257. echo'<tr>';
    258. echo'<td>E-Mail Adresse [Kontrolle]</td>';
    259. echo'<td><input type="text" name="emailw" maxlength="40" size="40"></td>';
    260. echo'</tr>';
    261. echo'</table>';
    262. }
    263. }else {
    264. echo'<div align="center"><font color="#FF0000">Die von Ihnen Angegebenen E-Mail Adressen stimmen nicht überein , bitte geben Sie diese erneut ein !</font></div>';
    265. echo'<table width="100%">';
    266. echo'<tr>';
    267. echo'<td width="30%">E-Mail Adresse</td>';
    268. echo'<td width="70%"><input type="text" name="email" maxlength="40" size="40"></td>';
    269. echo'</tr>';
    270. echo'<tr>';
    271. echo'<td>E-Mail Adresse [Kontrolle]</td>';
    272. echo'<td><input type="text" name="emailw" maxlength="40" size="40"></td>';
    273. echo'</tr>';
    274. echo'</table>';
    275. }
    276. }
    277. //ENDE FUNKTION EMAIL
    278. //ANFANG FUNKTION UNTEN
    279. function unten() {
    280. global $bundesland;
    281. global $muster1;
    282. if (ereg($muster1, $bundesland)){
    283. echo'<table width="100%">';
    284. echo'<tr>';
    285. echo'<td width="30%">Bundesland:</td>';
    286. echo'<td><input type="text" name="bundesland" maxlenght="30" size="30" value="'; echo $bundesland; echo'"></td>';
    287. echo'</tr>';
    288. echo'</table>';
    289. }else{
    290. echo'<div align="center"><font color="#FF0000">Bitte überprüfen Sie das von Ihnen angebene Bundesland!! Es darf keine Sonderzeichen enthalten!!Mit Ausnahme von " - "!!</font></div>';
    291. echo'<table width="100%">';
    292. echo'<tr>';
    293. echo'<td width="30%">Bundesland:</td>';
    294. echo'<td><input type="text" name="bundesland" maxlenght="30" size="30"></td>';
    295. echo'</tr>';
    296. echo'</table>';
    297. }
    298. }
    299. //ENDE FUNKTION UNTEN
    300. //ANFANG FUNKTION PARTNER
    301. function partner(){
    302. global $alter;
    303. global $groesse;
    304. global $haare;
    305. global $augen;
    306. global $geschlecht1;
    307. global $herkunft;
    308. echo'<p><div align="center"><font color="#FF0000" size="+2">Die Wunschdaten für ihren Traumpartner :</font></p>';
    309. echo'<table width="100%">';
    310. echo'<tr>';
    311. echo'<td width="30%">Herkunft:</td>';
    312. echo'<td width="70%"><select name="herkunft"><option selected>'; echo $herkunft; echo'</select></td>';
    313. echo'</tr>';
    314. echo'<tr>';
    315. echo'<td width="30%">Haarfarbe:</td>';
    316. echo'<td width="70%"><select name="haare"><option selected>'; echo $haare; echo'</select></td>';
    317. echo'</tr>';
    318. echo'<tr>';
    319. echo'<td width="30%">Augen</td>';
    320. echo'<td width="70%"><select name="augen"><option selected>'; echo $augen; echo'</select></td>';
    321. echo'</tr>';
    322. echo'<tr>';
    323. echo'<td width="30%">Suche:</td>';
    324. echo'<td width="70%"><select name="geschlecht1"><option selected>'; echo $geschlecht1; echo'</select></td>';
    325. echo'</tr>';
    326. echo'</table>';
    327. if (ereg($mustergroesse, $groesse)) {
    328. echo'<table width="100%">';
    329. echo'<tr>';
    330. echo'<td width="30%">Größe:</td>';
    331. echo'<td width="70%"><input type="text" name="groesse" maxlength="35" value="'; echo $groesse; echo'"></td>';
    332. echo'</tr>';
    333. echo'</table>';
    334. }else {
    335. echo'Bitte überprüfen Sie Ihre Eingaben!! Sie dürfen keine Sonderzeichen enthalten';
    336. echo'<table width="100%">';
    337. echo'<tr>';
    338. echo'<td width="30%">Größe:</td>';
    339. echo'<td width="70%"><input type="text" name="groesse" maxlength="35"></td>';
    340. echo'</tr>';
    341. echo'</table>';
    342. }
    343. if ($alter < "100"){
    344. if ($alter >"19"){
    345. echo'<table width="100%">';
    346. echo'<tr>';
    347. echo'<td width="30%">Alter:</td>';
    348. echo'<td width="70%"><input type="text" name="alter" maxlength="35" value="'; echo $alter; echo'"></td>';
    349. echo'</tr>';
    350. echo'</table>';
    351. }else {
    352. echo'<div align="center"><font color="#FF0000">Das mindest Alter beträgt 18 Jahre!!</font></div>';
    353. echo'<table width="100%">';
    354. echo'<tr>';
    355. echo'<td width="30%"><font color="#FF0000">Alter:</font></td>';
    356. echo'<td width="70%"><input type="text" name="alter" maxlength="35"></td>';
    357. echo'</tr>';
    358. echo'</table>';
    359. }
    360. }else {
    361. echo'<div align="center"><font color="#FF0000">Bitte geben Sie ein realistisches Alter ein!!</font></div>';
    362. echo'<table width="100%">';
    363. echo'<tr>';
    364. echo'<td width="30%"><font color="#FF0000">Alter:</font></td>';
    365. echo'<td width="70%"><input type="text" name="alter" maxlength="35"></td>';
    366. echo'</tr>';
    367. echo'</table>';
    368. }
    369. echo'<input type="submit" value="Abschicken">';
    370. }
    371. //ENDE FUNKTION PARTNER
    372. //FUNKTIONEN WE
    Alles anzeigen
  • Also ich muss sagen : RESPEKT !
    Ich denke besser kann man kaum ein Formular auswerten !
    Daher fallen mir keine Vebesserungsvorschläge ein, muss sagen mit all den Überprüfungen : echt super gelungen !
  • ich hab was zu meckern ;)
    bei so vielen übergaben rate ich dir, das formular auf method="post" umzuschreiben, weil die url-länge in browser ist begrenzt, während du mist post theoretisch "unendlich" (bei computern hat bekanntlich alles ne grenze ;) ) lange datensätze/variablen übertragen kannst
    nur so ne verbesserung am rande ;)

    cya dn87p
  • Danke für eure Antworten !!!

    Ja war echt viel Arbeit hab im Unterricht auch ne 1 für bekommen*g*

    Und auch Danke für den Verbesserungssvorschlag mit POST werde ich am We jetzt nochma überarbeiten!!!

    THX

    cu leude
  • wer braucht da noch bildungsreformen und eliteunis, wenns das fs-b gibt :D.

    GESCHLOSSEN.

    Falls noch weitere EInser nötig sind einfach PN an mich und schwubs ist dein thread wieder offen.