formmailer

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dkara

    formmailer

    Hi,
    I'd like to program a html/php form with select, checkbox, textarea,
    radiobuttons. This script should have an error check without loosing
    the inserted infomation and if all the fields are OK then to be sent as
    a mail to my account.
    Does anyone have an idea where to get this script?
    Thanks
    Hakan

  • Dinçer Akay

    #2
    Re: formmailer

    Hi, Send your php source code

    Comment

    • dkara

      #3
      Re: formmailer

      Below an example I got from the www.php-free.de (I am not sure ??).
      There I'd like to add a select field, checkbox and radio buttons with
      the same logic, i.e. check if error, do not delete all the information
      when false entry, etc.





      /* Example */

      <?php
      $adresse = "xy@xyz.com ";
      $absender = "1";
      $umbruch = "70";
      $bgcolor = "#F3F4F5";
      $textcolor = "#000000";
      $fehlercolor = "#FF3300";
      $head = "Hier Ihre Überschrift<br> Version 2.7.";
      $add = "";

      $lengthm = strlen($_POST["send"]["mail"]);
      $lengtha = strlen($_POST["send"]["autor"]);
      $lengthb = strlen($_POST["send"]["betreff"]);
      $lengthn = strlen($_POST["send"]["nachricht"]);
      $i = "0";

      if ($absender == "0") {
      $from = $adresse ; }
      else { $from = $_POST["send"]["mail"] ; }


      if(isset($_POST["send"]) && is_array($_POST["send"])) {
      if(empty($_POST["send"]["autor"])) {
      $fautor = "Sie müssen einen Namen eingeben!<br>";
      } else { $fautor = "Name ok!<br>"; $i++; }
      if(empty($_POST["send"]["betreff"])) {
      $fbetreff = "Sie müssen einen Betreff eingeben!<br>";
      } else { $fbetreff = "Betreff ok!<br>"; $i++; }
      if(empty($_POST["send"]["mail"])) {
      $fmail = "Sie müssen Ihre E-Mail-Adresse eingeben!<br>";
      } else { $fmail = "Adresse ok!<br>"; $i++; }
      if(empty($_POST["send"]["nachricht"])) {
      $fnachricht = "Sie müssen eine Nachricht eingeben!<br>";
      } else { $fnachricht = "Nachricht ok!<br>"; $i++; }
      if ($lengthm > "50") {
      $flmail = "Ihre eingegebene E-Mail-Adresse ist zu lang!<br>"; $fmail
      = ""; }
      else { $i++; }
      if ($lengtha > "30") {
      $flautor = "Ihr eingegebener Name ist zu lang!<br>"; $fautor = ""; }
      else { $i++; }
      if ($lengthb > "150") {
      $flbetreff = "Ihr eingegebener Betreff ist zu lang!<br>"; $fbetreff =
      ""; }
      else { $i++; }
      if ($lengthn > "60000") {
      $flnachricht = "Ihre eingegebene Nachricht darf nicht mehr<br> als
      60000 Zeichen haben! Sie hat: ".$lengthn."<br >"; $fnachricht = ""; }
      else { $i++; }
      if (!strpos($_POST["send"]["mail"], "@") == "false" or
      substr_count($_ POST["send"]["mail"], "@") > 1) {
      $fgmail = "Ihre angegebene E-Mail Adresse ist nicht gültig!<br>";
      $fmail = ""; }
      else { $i++; }
      if (substr_count($ _POST["send"]["autor"], "@") >= 1) {
      $fgautor = "Aus Sicherheitsgrün den darf das Namensfeld kein @
      Zeichen enthalten!<br>" ; $fautor = "";
      } else { $i++; }
      $str = ":\/,\"";
      if (strcspn($_POST["send"]["mail"], $str) < $lengthm) {
      $fgmail = "Ihre angegebene E-Mail Adresse ist nicht gültig!<br>";
      $fmail = "" ;
      } else { $i++ ; }
      if (get_magic_quot es_gpc() == "1") {
      $_POST["send"]["autor"] = stripslashes($_ POST["send"]["autor"]);
      $_POST["send"]["betreff"] = stripslashes($_ POST["send"]["betreff"]);
      $_POST["send"]["mail"] = stripslashes($_ POST["send"]["mail"]);
      $_POST["send"]["nachricht"] =
      stripslashes($_ POST["send"]["nachricht"]);
      }
      $sautor = htmlspecialchar s($_POST["send"]["autor"]);
      $sbetreff = htmlspecialchar s($_POST["send"]["betreff"]);
      $smail = htmlspecialchar s($_POST["send"]["mail"]);
      $snachricht = htmlspecialchar s($_POST["send"]["nachricht"]);
      }


      if(isset($_POST["send"]) && is_array($_POST["send"])) {
      if ($i == "11") {
      $autor = $_POST["send"]["autor"];
      if ($umbruch == "no") {
      $texto = $_POST["send"]["nachricht"] ;
      }
      else { $texto = wordwrap( $_POST["send"]["nachricht"], $umbruch ); }
      $_POST["text"] = $_POST["send"]["autor"]." mit der Mail Adresse:
      ".$_POST["send"]["mail"]." hat ihnen folgende Nachricht gesendet: \n \n
      $texto";
      $fautor = "<h2>Ihre Mail wurde versendet!</h2>";
      $fbetreff = "";
      $fmail = "";
      $fnachricht = "";

      if(empty($add)) {
      $addp = "";
      if (@mail($adresse , $_POST['send']['betreff'], $_POST['text'],
      "From: \"$autor\" <$from>")) {
      $fautor = "<h2>Ihre Mail wurde versendet!</h2>";
      unset($sautor);
      unset($sbetreff );
      unset($smail);
      unset($snachric ht);
      } else {
      $fautor = "<h2>Fehler ! Mail konnte nicht gesendet werden</h2>"; }
      } else {
      if (@mail($adresse , $_POST['send']['betreff'], $_POST['text'],
      "From: \"$autor\" <$from>", "-f $add")) {
      $fautor = "<h2>Ihre Mail wurde versendet!</h2>";
      unset($sautor);
      unset($sbetreff );
      unset($smail);
      unset($snachric ht);
      }
      else {
      $fautor = "<h2>Fehler ! Mail konnte nicht gesendet werden</h2>"; }
      }
      }
      }

      ?>
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
      "http://www.w3.org/TR/html4/strict.dtd">
      <html>
      <head>
      <style type="text/css">
      </style>
      <title></title>
      <meta name='author' content='Klaus Mooser'>
      <meta http-equiv='Content-Type' content='text/html;
      charset=ISO-8859-1'>
      </head>
      <body>
      <h1><?php echo $head ; ?></h1>
      <form class="formular " action="<?php echo $PHP_SELF;?>" method="post"
      target="_self">
      <div class="fehler"> <?php echo $fautor ; echo $fbetreff ; echo $fmail ;
      echo $fnachricht ; echo $flautor ; echo $flbetreff ; echo $flnachricht
      ; echo $flmail ; echo $fgmail ; echo $fgautor ;?></div>
      <div class="box">
      <div class="um">
      <div class="bez"><la bel for="autor">Ihr Name:</label></div>
      <div><input name='send[autor]' type='text' id="autor" size='20'
      value="<?php echo $sautor ; ?>"></div>
      </div>
      <div class="um">
      <div class="bez"><la bel for="betreff">B etreff:</label></div>
      <div><input name='send[betreff]' type='text' id="betreff" size='20'
      value="<?php echo $sbetreff ; ?>"></div>
      </div>
      <div class="um">
      <div class="bez"><la bel for="mail">E-Mail Adresse:</label></div>
      <div><input name='send[mail]' type='text' id="mail" size='20'
      value="<?php echo $smail ; ?>"></div>
      </div>
      </div>

      <div class="nachrich t">
      <br><label for="nachricht" >Ihre Nachricht:</label><br><text area
      name='send[nachricht]' id="nachricht" rows='10' cols='40'><?php echo
      $snachricht ;?></textarea><br>
      <input type='submit' value='Absenden '><p></p>
      </div>
      </form>
      <p></p>
      </body>
      </html>

      Comment

      • Geoff Berrow

        #4
        Re: formmailer

        I noticed that Message-ID:
        <1120329450.602 455.215360@g47g 2000cwa.googleg roups.com> from dkara
        contained the following:
        [color=blue]
        >Hi,
        >I'd like to program a html/php form with select, checkbox, textarea,
        >radiobuttons . This script should have an error check without loosing
        >the inserted infomation and if all the fields are OK then to be sent as
        >a mail to my account.
        >Does anyone have an idea where to get this script?[/color]


        --
        Geoff Berrow (put thecat out to email)
        It's only Usenet, no one dies.
        My opinions, not the committee's, mine.
        Simple RFDs http://www.ckdog.co.uk/rfdmaker/

        Comment

        Working...