Moin!
ich bin gerade ein bisschen am Verzweifeln über meinen Code einer Test-Website. Dazu muss man sagen, dass ich ziemlicher Neuling in der Webentwicklung bin, ich schließe also auf einen typischen Anfängerfehler
...
Also, es geht um Folgendes: Eine Website soll im Großen und Ganzen ein paar Buttons anzeigen. Wird einer von diesen gedrückt, so soll ein PHP-Script aktiviert werden, dass eine Zahl in eine Textdatei schreibt. Bei meiner Version wird jetzt aber (glaube ich) noch nicht einmal das Script aufgerufen. Ich habe das ganze über xampp gestartet.
Hier die Codes:
example.html
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<html>
<head>
</head>
<body>
<form action="auswertung.php" method="post">
<input type="button" name="A1" value="foo">
<input type="button" name="A2" value="bar">
<input type="button" name="A3" value="foobar">
</form>
<br />
<br />
<form action="auswertung.php" method="post">
<input type="button" name="B1" value="foo2">
<input type="button" name="B2" value="bar2">
<input type="button" name="B3" value="foobar2">
</form>
</body>
</html>
|
auswertung.php
|
Quellcode
|
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
|
<?php
if (isset($_POST['A1']))
{
$datei = fopen("foo.txt", "w");
fwrite($datei, "-1");
fclose($datei);
}
if (isset($_POST['A2']))
{
$datei = fopen("foo.txt", "w");
fwrite($datei, "0");
fclose($datei);
}
if (isset($_POST['A3']))
{
$datei = fopen("foo.txt", "w");
fwrite($datei, "1");
fclose($datei);
}
if (isset($_POST['B1']))
{
$datei = fopen("bar.txt", "w");
fwrite($datei, "-1");
fclose($datei);
}
if (isset($_POST['B2']))
{
$datei = fopen("bar.txt", "w");
fwrite($datei, "0");
fclose($datei);
}
if (isset($_POST['B3']))
{
$datei = fopen("bar.txt", "w");
fwrite($datei, "1");
fclose($datei);
}
?>
|
Ich hoffe, ihr könnt mir auf die Sprünge helfen
Grüße