PHP/HTML Kontaktformular Problem

Dieses Thema im Forum "Webentwicklung" wurde erstellt von marcel, 23. September 2008 .

  1. 23. September 2008
    Hey ihr

    habe auf meiner HP ein Kontaktformular, hat auch bis jetzt wunderbar funktioniert. Jetzt habe ich ein WYSISWYG Editor auf der Seite eingebaut, den hier.

    Mein Problem ist, das wenn ich alle Felder ausgefüllt habe im Formular und auf "register" klicke, bekomme ich eine mail mit allen Daten außer der Daten (bzw. html code), die ich im WYSISWYG Editor eingegeben habe. Diese möchte ich natürlich auch übertragen habe.

    Damit wollt ich bezwecken, das man das Feld "Nachricht" im Kontaktformular mit HTML gestalten kann. Hier mal ein Auszug aus meiner register.html:


    Code:
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>register</title>
    <link type="text/css" rel="stylesheet" href="rte.css" />
    <style type="text/css">
    <!--
    body {
     background-color: #000000;
     scrollbar-arrow-color: #b300d4;
    scrollbar-base-color: #000000;
    }
    .Stil6 {
     font-family: Geneva, Arial, Helvetica, sans-serif;
     color: #b300d4;
     font-size: 10px;
    }
    .Stil8 {
     font-family: Geneva, Arial, Helvetica, sans-serif;
     color: #b300d4;
     font-size: 12px;
    }
    body,td,th {
     color: #FFFFFF;
    }
    -->
    </style>
    </head>
    
    <body>
    <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
     <tr>
     <td align="center" valign="top"><table height="250" width="840" border="0" cellpadding="0" cellspacing="0">
     <tr>
     <td colspan="2"><img src="images/step.jpg" width="237" height="34"></td>
     </tr>
    <form action="kontaktformular-auswerten.php" method="post">
    <tr>
     <td colspan="2">&nbsp;</td>
     <td>&nbsp;</td>
     <td width="300" rowspan="8" background="images/oldschool.gif">&nbsp;</td>
     <td>&nbsp;</td>
    </tr>
    <tr>
     <td colspan="2">&nbsp;</td>
     <td>&nbsp;</td>
     <td width="13">&nbsp;</td>
    </tr>
    <tr>
     <td>&nbsp;</td>
     <td><span class="Stil6">your Artist/ Bandname:</span></td>
     <td><input name="Name" size="30" type="text"></td>
     <td width="13">&nbsp;</td>
    </tr>
    <tr>
     <td width="9">&nbsp;</td>
     <td width="244">&nbsp;</td>
     <td width="277">&nbsp;</td>
     <td width="13">&nbsp;</td>
    </tr>
    <tr>
     <td>&nbsp;</td>
     <td><span class="Stil6">your Email-adress:</span></td>
     <td><input name="Email" size="30" type="text"></td>
     <td width="13">&nbsp;</td>
    </tr>
    <tr>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td width="13">&nbsp;</td>
    </tr>
    <tr>
     <td>&nbsp;</td>
     <td><span class="Stil6">your homepage/myspace:</span></td>
     <td><input name="HP" size="30" type="text"></td>
     <td width="13">&nbsp;</td>
    </tr>
    <tr>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td width="13">&nbsp;</td>
    </tr>
    <tr>
     <td>&nbsp;</td>
     <td><span class="Stil6">subject:</span></td>
     <td><select name="Betreff" size="1">
     <option selected>register</option>
     </select> </td>
     <td width="297">&nbsp;</td>
     <td width="13">&nbsp;</td>
    </tr>
    <tr>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td width="297">&nbsp;</td>
     <td width="13">&nbsp;</td>
    </tr>
    <tr>
     <td>&nbsp;</td>
     <td><p class="Stil6">about yourself / the band:<br>
     (this will be your description in our ranking)</p> </td>
     <td colspan="2">
     <textarea name="Nachricht" class="rte-zone">TYPE HERE...</textarea>
     <script type="text/javascript" src="toolbox/jquery.js"></script>
    <script type="text/javascript" src="toolbox/jquery.rte.js"></script>
    <script type="text/javascript">
     $('.rte-zone').rte("rte.css", "toolbox/images/");
    </script>
     </td>
     <td width="13">&nbsp;</td>
    </tr>
    <tr>
     <td>&nbsp;</td>
     <td colspan="5">&nbsp;</td>
    </tr>
    <tr>
     <td colspan="6"><div align="center"><span class="Stil6">// make sure your enter is correct. You can't change your enter if you clicked the &quot;register&quot; button.</span></div></td>
     </tr>
    <tr>
     <td>&nbsp;</td>
     <td colspan="5">&nbsp;</td>
    </tr>
    <tr>
     <td>&nbsp;</td>
     <td colspan="5">&nbsp;</td>
    </tr>
    <tr>
     <td width="9">&nbsp;</td>
     <td colspan="5"><div align="center">
     <input name="Send" type="submit" value="register">
     </div></td>
     </tr>
    </form>
     </table></td>
     </tr>
    </table>
    </body>
    
    
    
    und hier meine kontaktformular-auswerten.php:

    Code:
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>register</title>
    <style type="text/css">
    <!--
    body {
     background-color: #000000;
    }
    .Stil6 {
     font-family: Geneva, Arial, Helvetica, sans-serif;
     color: #b300d4;
     font-size: 10px;
    }
    .Stil8 {
     font-family: Geneva, Arial, Helvetica, sans-serif;
     color: #b300d4;
     font-size: 12px;
    }
    body,td,th {
     color: #FFFFFF;
    }
    -->
    </style></head>
    
    <body>
    <?php
    
    $Empfaenger = "xxx@gmail.com";
    
    if($_REQUEST['Send'])
    {
     if(empty($_REQUEST['Name']) || empty($_REQUEST['Email']) )
     {
     echo"Please go <a href=\"javascript:history.back();\">back</a> and try it again!";
     }
     else
     {
     $Mailnachricht = "Sie haben folgende Nachricht erhalten: \n\n";
     while(list($Formularfeld, $Wert)=each($_REQUEST))
     {
     if($Formularfeld!="Send")
     {
     $Mailnachricht .= $Formularfeld.": ".$Wert."\n\n";
     }
     }
     $Mailnachricht .= "\n\n\n\nDatum/Zeit: ";
     $Mailnachricht .= date("d.m.Y H:i:s");
     $Mailbetreff = "Kontakt: ";
     $Mailbetreff .= $_REQUEST['Betreff'];
     mail($Empfaenger, $Mailbetreff, $Mailnachricht, "From: ".$_REQUEST['Email']);
     echo"Thank you for your e-mail! Your registration was successful. You get within 24 hours an email from us.";
     }
    }
    else
    {
     echo"Error. Please go on this <a href=\"register.php\">Site</a>.";
    }
    
    ?>
    </body>
    Hoffe ihr könnt mir helfen, danke schonmal
     
  2. 23. September 2008
    AW: PHP/HTML Kontaktformular Problem

    Nimm nicht $_REQUEST zum auslesen, sondern $_POST, du sendest die Daten schliesslich immer mit POST.

    So jetzt zu deinem eigentlichen Problem. Der code befindet sich nicht in einem input oder textarea-Feld und wird deshalb nicht mitgeschickt.

    Die einfachste Methode ist es, den Code mit .innerHTML in ein input-Feld mit dem Type=hidden vor dem submitten des Formulars zu speichern.

    Dann kannst du in PHP einfach auf das hiddenfeld zugreifen.
     
  3. 23. September 2008
    AW: PHP/HTML Kontaktformular Problem

    hallo async, erstmal danke für deine antwort hört sich gut an, aber ich kann dir nicht ganz folgen. Hab das Script runtergeladen und mit meinem (wenigen) php Kenntnissen bearbeitet.

    welcher code meinst du, befindet sich nicht in der <textarea></textarea> ? das <script>?
    Meinst du mit .innerHTML den Textarea code in ne extra html zu packen un dann mittels input src auf die zugreifen mit type=hidden?
    danke schonmal
     
  4. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.