Formular in php...

Dieses Thema im Forum "Webentwicklung" wurde erstellt von Vergamer, 17. August 2006 .

Schlagworte:
Status des Themas:
Es sind keine weiteren Antworten möglich.
  1. 17. August 2006
    Kann mir hier irgendjemand eine passende .php für dieses Formular machen, damit es als Kontaktformular funktioniert? Wie ihr sehen werdet, hat es 5 Empfänger zur Auswahl, d.h. die Nachricht muss immer nur an den angegebenen Empfänger gesendet werden...

    HTML-Code:
    PHP:
    < div style = "padding-top:5px;padding-left:30px;padding-right:20px " >
    <
    span  class= "style5" >< strong > Kontaktformular </ strong > </ span >
    <
    div  class= "t11"  style = "padding-top:10px; color: #6395c7;" >
    Deine eMail - Adresse </ div >
    <
    div style = "padding-top:2px " >
    <
    input type = "text"  style = "width:160px; height:20px; font-family:Tahoma; font-size:11px " >
    </
    div >

    <
    div  class= "t11"  style = "padding-top:5px; color: #6395c7;" >
    Wen m & ouml ; chtest du kontaktieren ?
    </
    div >
    <
    div style = "padding-top:2px " >
    <
    select style = "width:160px; height:20px; font-family:Tahoma; font-size:11px " >< option > Band </ option >< option > Sarah </ option >< option > Roman </ option >
      <
    option > D & ouml ; mel </ option >
      <
    option > Philipp </ option >< option > Martin </ option >
    </
    select >
    </
    div >

    <
    div  class= "t11"  style = "padding-top:5px; color: #6395c7;" >
    Nachricht
    </
    div >
    <
    div style = "padding-top:2px " >
    <
    textarea style = "width:220px; height:80px; font-family:Tahoma; font-size:11px " ></ textarea >
    </
    div >
    <
    div align = "right"  class= "t11"  style = "padding-right:10px;padding-top:5px; font-weight: bold;" >
         <
    a href = "#"  class= "1" > Senden </ a >    & nbsp ; < a href = "#"  class= "1" > L & ouml ; schen </ a ></ div >
         <
    div style = "padding-top:10px " >
    Wäre echt nice, wenn mir hier jemand helfen könnte, 10ner usw. natürlich für die Hilfe... Wenn ihr noch fragen diesbezüglich habt, entweder hier in den Thread schreiben, im IRC kontaktieren oder eine PN senden...

    Mfg
    Vergamer

    PS: Ihr müsst mir jetzt keine Links zu Tutorials schicken, habe schon viele angeschaut und hab keins gepeilt... Das wird etwas vom einzigen sein, dass ich je in php machen muss, deswegen will ich nicht extra php lernen...
     
  2. 18. August 2006
    PHP:
    <form action="<?php  echo  $_SERVER [ 'PHP_SELF' ];
    ?>" method="post">
    <div style="padding-top:5px;padding-left:30px;padding-right:20px ">
        <span class="style5">
            <strong>Kontaktformular</strong> 
        </span>
        <div class="t11" style="padding-top:10px; color: #6395C7;">
            Deine eMail-Adresse
        </div>
        <div style="padding-top:2px ">
            <input type="text" name="email" style="width:160px; height:20px; font-family:Tahoma; font-size:11px;">
        </div>
        <div class="t11" style="padding-top:5px; color: #6395c7;">
            Wen m&ouml;chtest du kontaktieren?
        </div>
        <div style="padding-top:2px ">
            <select name="empfeanger" style="width:160px; height:20px; font-family:Tahoma; font-size:11px ">
                <option>Band</option>
                <option>Sarah</option>
                <option>Roman</option>
                <option>D&ouml;mel</option>
                <option>Philipp</option>
                <option>Martin</option>
            </select>
        </div>
        <div class="t11" style="padding-top:5px; color: #6395c7;">
            Nachricht: 
        </div>
        <div style="padding-top:2px ">
            <textarea name="nachricht" style="width:220px; height:80px; font-family:Tahoma; font-size:11px "></textarea>
        </div>
        <div align="right" class="t11" style="padding-right:10px;padding-top:5px; font-weight: bold;">
            <input type="submit" value="Senden" name="submit">    &nbsp; <input type="reset" value="L&ouml;schen"></div>
        <div style="padding-top:10px ">
    </div>
    </form>
    <?php
    if (isset( $_POST [ 'submit' ])) {
        
    $fehler  false ;
        
    $fehlertext  "" ;
        
        
    $muster  "/^[a-zA-Z0-9-_.]+@[a-zA-Z0-9-_.]+\.[a-zA-Z]{2,4}$/" ;
        if (empty(
    $_POST [ 'email' ])) {
            
    $fehler  true ;
            
    $fehlertext  .=  "Die E-Mail-Adresse fehlt!<br />\n" ;
        }
        else if (
    preg_match ( $muster $_POST [ 'email' ]) ==  0 ) {
            
    $fehler  true ;
            
    $fehlertext  .=  "Die E-Mail-Adresse ist ungültig!<br />\n" ;
        } 

        switch (
    $_POST [ "empfeanger" ]) {
        case 
    "Band" :
        
    $mail  "E-mailadresse" ;
        break;
        case 
    "Sarah" :
        
    $mail  "E-mailadresse" ;
        break;
        case 
    "Roman" :
        
    $mail  "E-mailadresse" ;
        break;
        case 
    "D&ouml;mel" :
        
    $mail  "E-mailadresse" ;
        break;
        case 
    "Philipp" :
        
    $mail  "E-mailadresse" ;
        break;
        case 
    "Martin" :
        
    $mail  "E-mailadresse" ;
        break;
        }
        
        if (empty(
    $_POST [ 'nachricht' ])) {
            
    $fehler  true ;
            
    $fehlertext  .=  "Die Nachricht fehlt!<br />\n" ;
        }
        else if (
    strlen ( $_POST [ 'nachricht' ]) <  3 ) {
            
    $fehler  true ;
            
    $fehlertext  .=  "Die Beschreibung ist zu kurz<br />\n" ;
        } 

        if (
    $fehler ) {
            echo 
    "<p><font size='3' color='#FF0000'> $fehlertext </font></p>" ;
        }
        else {
            
    $mailbody  .=  $_POST [ 'nachricht' ];
            
    $mailbody  stripslashes ( $mailbody );
            if (@
    mail ( " $mail " ">>>Beterff der Mail<<<" $mailbody "From:  $_POST [ email ] " )) {
                echo 
    '<p><font color="#00FF00">Ihre Anfrage wurde weitergeleitet.</font></p>' ;
            } else {
                echo 
    '<p><font color="#FF0000">Es gab leider einen Sendefehler!</font></p>' ;
            } 
        } 


    ?>
    Ich hoffe das ist zufriedendstellend.
     
  3. 18. August 2006
    Passt fast perfekt :] Musste nur bei den versch. eMail-Addys das
    PHP:
    case  "D&ouml;mel" :
        
    $mail  "E-mailadresse" ;
    zu
    PHP:
    case  "Dömel" :
        
    $mail  "E-mailadresse" ;
    ändern... Weils ja vom HTML mit ö angezeigt wird... ^^

    Thx vielmals, 10ner ist raus...

    Ich close hier mal
     
  4. 19. August 2006
    Hrhr, ein von nem Mod geschlossenes Thema reopened... xD

    Also, das nächste Problem ist:

    Im Firefox wirds (auf der Page eingebunden) ganz richtig angezeigt, also transparenter Hintergrund und so...

    Der IE macht aber mal wieder Probleme... Dort hat die PHP einen weissen Hintergrund... Grml... Kann mir jemand sagen, wie ich den noch wegbekomme? 10ner natürlich...
     
  5. 19. August 2006
    Kannst du vielleicht einen Link zum Formular posten, denn ich kann mir jetzt nicht vorstellen was du meinst.
     
  6. 19. August 2006
    Du benutzt nen IFrame... Firefox macht die standartäßig durchsichtig wenn nicht anderes angegeben ist. Einfach die Seite mit dem Formular mit nem Hintergrundbild versehen und schon macht der IE keine Probs mehr
     
  7. 19. August 2006
    Ok, habs geschafft xD

    ---closed---
     
  8. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.