PHP Kontaktfomular einbetten?

jonny8

Ensign
Registriert
Nov. 2005
Beiträge
239
Hi all,
ich sitz hier schon den ganzen Tag an diesem besch7$/§$ PHP kontakt formular:
PHP:
<?php
            $v0 = $_POST ["0"];$v1 = $_POST ["1"];$v2 = $_POST ["2"];$v3 = $_POST ["3"];$v4 = $_POST ["4"];$v5 = $_POST ["5"];$v6 = $_POST ["6"];$v7 = $_POST ["7"];$v8 = $_POST ["8"];$v9 = $_POST ["9"];
            $datum = date("d.m.Y");
            $uhrzeit = date("H:i");
            $mitteilung="Hallo, am $datum wurde eine Nachricht über Ihr Kontaktformular an Sie versendet. Inhalt: Name: ".$v0." ".$v1." Strasse: ".$v2." PLZ: ".$v3." Tel: ".$v4." eMail: ".$v5." Anzahl: ".$v6." Datum: ".$v7." Uhrezit:".$v8."  Mit freundlichen Grüßen";
            $mail="XXX@XXX.de";
            $send=$_POST['s'];
            function random($name_laenge) {
                $zeichen = "abcedfhiklmnorstuvwxzABCDEFGHIJKLMNOPRTSUVWXYZ0123456789";
                $name_neu = "";
                mt_srand ((double) microtime() * 1000000);
                for ($i = 0; $i < $name_laenge; $i++ ) {
                    $name_neu .= $zeichen{mt_rand (0,strlen($zeichen))};
                }
                return $name_neu;
            }
            $zufall = random(4);
            $zufall2 = $zufall;
            $code = $zufall2;

            if(($send!="1"))
            {
        ?>
        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
            <table id="tableOne" border="0" cellpadding="0" cellspacing="5"><tbody><tr><td colspan="2"> <h1></h1> </td></tr><tr> <td>Vorname:</td><td><input style="font-family: arial; font-size: 12px; height: 20px; width: 180px; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); border: 1px solid rgb(0, 0, 0);" name="0" type="text"></td> </tr><tr> <td>Nachname:</td><td><input style="font-family: arial; font-size: 12px; height: 20px; width: 180px; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); border: 1px solid rgb(0, 0, 0);" name="1" type="text"></td> </tr><tr> <td>Straße:</td><td><input style="font-family: arial; font-size: 12px; height: 20px; width: 200px; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); border: 1px solid rgb(0, 0, 0);" name="2" type="text"></td> </tr><tr> <td>PLZ:</td><td><input style="font-family: arial; font-size: 12px; height: 20px; width: 180px; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); border: 1px solid rgb(0, 0, 0);" name="3" type="text"></td> </tr><tr> <td>Tel:</td><td><input style="font-family: arial; font-size: 12px; height: 20px; width: 180px; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); border: 1px solid rgb(0, 0, 0);" name="4" type="text"></td> </tr><tr> <td>eMail:</td><td><input style="font-family: arial; font-size: 12px; height: 20px; width: 180px; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); border: 1px solid rgb(0, 0, 0);" name="5" type="text"></td> </tr><tr> <td>Anzahl Personen:</td><td><input style="font-family: arial; font-size: 12px; height: 20px; width: 180px; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); border: 1px solid rgb(0, 0, 0);" name="6" type="text"></td> </tr><tr> <td>Datum:</td><td><input style="font-family: arial; font-size: 12px; height: 20px; width: 180px; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); border: 1px solid rgb(0, 0, 0);" name="7" type="text"></td> </tr><tr> <td>Uhrzeit:</td><td><input style="font-family: arial; font-size: 12px; height: 20px; width: 180px; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); border: 1px solid rgb(0, 0, 0);" name="8" type="text"></td> </tr><tr> </tr></tbody></table>
<table id="tableThree" border="0" cellpadding="0" cellspacing="5"><tbody><tr><td colspan="2"><p><button type="submit">Absenden</button></p></td></tr></tbody></table>
            <p><input type="hidden" value="1" name="s" /></p>
        </form>

Das hab ich aus einem "Kontaktformular generator"...
Ich wollts einfach in meine Page einbauen doch leider funktioniert es einfach nicht. Ich habe den obigen ausschnitt in meine Homepage eingebaut...

Bitte erbarme sich jemand einer PHP unkundigen Seele
 
Hat die Datei, in dem der PHP-Code steht, auch die Endung .php? Und unterstützt dein Webspace überhaupt PHP?

Nur um erst mal die größten Fehlerquellen auszuschließen bevor ich mir den Quelltext im Detail angucke ^^

/edit: deine IF-Anweisung vor dem (erstmaligen) Schließen des PHP-Codes ist unvollständig.
 
Zuletzt bearbeitet:
if (...)
{
KLAMMER IMMER SCHLIEßEN!
}

<form action="'.$_SERVER['PHP_SELF'].'" method="post">
 
Zuletzt bearbeitet:
Was soll das Formular denn machen?
Dieses schickt meiner Meinung nach keine Email weg.
PHP:
$zufall = random(4);
$zufall2 = $zufall;
$code = $zufall2;
Kann man auch ganz einfach in
PHP:
$code = random(4);
schreiben. (Aber da es ja aus einem Generator ist :D)

MfG
 
setz das mal vor die $date -Variable...
date_default_timezone_set('UTC');

und wie schon gesagt nutze:
<form action="'.$_SERVER['PHP_SELF'].'" method="post">

oder einfach alles in PHP:
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post"> ';

ansonsten Fallunterscheidungen immer schließen { ... }
 
AndrewPoison schrieb:
Hat die Datei, in dem der PHP-Code steht, auch die Endung .php? Und unterstützt dein Webspace überhaupt PHP?

Nur um erst mal die größten Fehlerquellen auszuschließen bevor ich mir den Quelltext im Detail angucke ^^

/edit: deine IF-Anweisung vor dem (erstmaligen) Schließen des PHP-Codes ist unvollständig.
die datei ist eine html datei in die ich den code eingefügt habe, ich habe jedoch die datei soeben umbenannt und es mit der php datei probiert...

habe sonst eure änderungsvorschläge alle umgesetzt

--> fehlschlag

PHP-Version 5.2.13
 
Zuletzt bearbeitet:
Zurück
Oben