• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

Hilfe beim Kontaktformular

k-f-r

Neues Mitglied
Hallo Leute,
erst mal ein gesundes neues Jahr für alle!

ich habe mir ein Kotaktformular erstellet und nun weiß ich nicht wie ich es anspreche.
auf meiner alten seite wird das kontaktformular aus flash raus über ein php script angesprochen kann ich es noch weiterverwenden?
hier mal das neue Formular
PHP:
 <div class="tahoma11" style="margin-left:11px; margin-top:5px ">
                  <form style="margin-top:50px "><table width="346"  border="0" cellspacing="3" cellpadding="0">
                    <tr>
                      <td width="64" valign="top"><div class="tahoma11" style="margin-left:11px; margin-top:5px ">
                        <div align="right"><span class="red">Name:</span><br>
                        </div>
                      </div></td>
                      <td width="273"><span class="blue2">
                        <input type="text" name="textfield2" style=" height:17px; width:266px; border-style:solid; border-width:1px; border-color:#999999; font-size:10px "></span></td>
                    </tr>
                    <tr>
                      <td valign="top"><div align="right">
                        <div class="tahoma11" style="margin-left:11px; margin-top:5px ">
                          <div align="right"><span class="red">E-mail:</span><br>
                          </div>
                        </div>
                      </div></td>
                      <td><span class="blue2">
                        <input type="text" name="textfield22" style=" height:17px; width:266px; border-style:solid; border-width:1px; border-color:#999999; font-size:10px ">
                      </span></td>
                    </tr>
                    <tr>
                      <td valign="top"><div align="right">
                        <div class="tahoma11" style="margin-left:11px; margin-top:5px ">
                          <div align="right"><span class="red">Message:</span><br>
                          </div>
                        </div>
                      </div></td>
                      <td><span class="red2">
                        <textarea name="textfield23" style=" height:150px; width:400px; border-style:solid; border-width:1px; border-color:#999999; font-size:11px "></textarea>
                      </span></td>
                    </tr>
                    <tr>
                      <td valign="top">&nbsp;</td>
                      <td><div align="right">
                        <input name="imageField2" type="image" src="Bilder/button_submit.gif" width="48" height="19" border="0">
                        <input name="imageField3" type="image" src="Bilder/button_clear.gif" width="43" height="19" border="0" style="margin-right:9px ">
                      </div></td>
                    </tr>
                  </table>
                </form>
</div>

und hier mal das alte php script
PHP:
<?
$name = $_POST['your_name'];
$name = str_replace('&777&Your Name:','',$name);
$tel = $_POST['telephone'];
$tel = str_replace('&777&Telephone:','',$tel);
$nachricht = $_POST['message'];
$nachricht = str_replace('&777&Your Message:','',$nachricht);
$email = $_POST['your_email'];
$email = str_replace('&777&E-mail Address:','',$email);
$empfaenger ='[email protected]';
$subject = 'Kontaktmail';
$mailout = '<html>
    <head>
        <title>Kontakt Mail</title>
    </head>
    <body>
        <table width="400" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td align="center" colspan="2"><h3>Neue Kontaktnachricht</h3></td>
            </tr>
            <tr>
                <td><b>Nachricht von:</b></td><td>'.$name.'</td>
            </tr>
            <tr>
                <td><b>Emailadresse:</b></td><td><a href="mailto:'.$email.'?subject=Ihre%20Kontaktanfrage">'.$email.'</a></td>
            </tr>
            <tr>
                <td><b>Telefonnummer:</b></td><td>'.$tel.'</td>
            </tr>
            <tr>
                <td colspan="2"><hr></td>
            </tr>
            <tr>
                <td colspan="2">'.$nachricht.'</td>
            </tr>
        </table>
    </body>
</html>
';
$headers .= 'X-Mailer: PHP/' . phpversion() . "\n";
$headers .= 'X-Sender-IP: ' . $REMOTE_ADDR . "\n";
$headers .= "Content-type: text/html\n";
$sende = @mail($empfaenger, $subject, $mailout, $headers);
if($sende) {
echo 'Deine Kontaktanfrage wurde erfolgreich &uuml;bermittelt.<br>Ich setze mich in k&uuml;rze mit Dir in Verbindung.';
} else {
echo 'Leider tauchte ein Fehler mit dem Senden Ihrer Kontaktanfrage auf.';
}
?>

kann mir bitte einer helfen!
LG
 
Du musst zumindest die name-Attribute der Formularelemente (input, textarea) von "textfield2" auf "your_name" usw. ändern (die Werte, die im PHP-Teil im $_POST-Array stehen). Außerdem braucht dein Formular eine action und eine method:

Code:
<form style="margin-top:50px " action="adresse-des-php-scripts.php" method="post">

Dann fehlt wohl noch ein Button zum Abschicken:

Code:
<input type="submit" value="Abschicken" />

Das wären ein paar Schritte in die richtige Richtung.
 
Zuletzt bearbeitet:
Oder du lernst erstmal PHP Grundlagen bevor du ein Kontaktformuar schreibst

<div class="tahoma11" style="margin-left:11px; margin-top:5px ">
Falch wenn du schon eine Class hast dann schreibt das margin in die Klasse im CSS sonst bekommst du ein Durcheinander.
das ist auch bei den anderen so.

Du musst auch ein action machen und ein button.
weil ohne button... die action gibt an wo das Formular geschickt werden soll
z.b

HTML:
<form action="deinskript.php" method="POST" class="deineclass">
<imput type="text" name="deinname" class="deineclass">
<imput type ="button" class="deineclass">
</form>
so hast du dein erstes richtige Formular. Mit Namen und abschicken zu deinskript.php. Im Deinskript.php da wo es geschickt wurde kannst du belibiege sachen machen hier ein beispiel:

Deinskript.php

PHP:
<?php
echo $_POST['name'];
?>
was macht das skript?
es gibt den Text das im Formular eingegebn aus. Anstatt POST könnte mann auch GET verwenden aber wir haben ja im Formular POST geschrieben.

So ich hoffe ich konnte dir ensprechend weiterhelfen.
 
Zurück
Oben