Hallo alle,
bin gerade dabei ein Formular zu programmieren, hier der HTML Code dafür:
Alles anzeigen
Dazu gibt es noch eine senden.php und einen Ordner includes mit einer functions.php. Wenn Ihr das Formular mal selber in eine HTML Datei schreibt und mit Firefox o.ä. öffnet, seht ihr das ich an einer Stelle ein Bild hochladen möchte, das ganze soll das per Email verschickt werden.
Leider habe ich wenige Kentnisse in PHP um das komplett alleine zu schreiben..
Kann mir jemand helfen? Bis jetzt sehen meine PHP Dateien so aus:
senden.php:
Alles anzeigen
includes/functions.php:
Alles anzeigen
Danke im Vorraus,
sn0w
bin gerade dabei ein Formular zu programmieren, hier der HTML Code dafür:
HTML-Quellcode
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <title>Sign-Line Formular</title>
- <style>
- body {font-family:Arial;font-size:12px;}
- input, label {display:inline-block;}
- label {cursor:pointer;}
- h1, h2, h3 {color:#e3001b;}
- </style>
- </head>
- <body>
- <form action="" method="POST">
- <span>Hier können Sie Ihre <strong>Fragen & Veredelungswünsche</strong></span><br />
- <span><label for="artikelname">zum folgenden Artikel stellen:</label></span>
- <input id="artikelname" type="text" name="Artikelname" /><br />
- <span><label for="kundennummer">Kundennummer:</label></span>
- <input id="kundennummer" type="text" name="Kundennummer" /><br />
- <h2>Zur Kalkulation benötigen wir Ihre Logodaten!</h2><br />
- <span><label for="logoupload">Bitte hier anhängen:</label></span>
- <input id="logoupload" type="file" name="Logo" />
- <span><label for="logouplaod">Dateiformate: jpg, tif, pdf, eps</label></span><br />
- <span><label for="attachdata">Angehängte Daten:</label></span>
- <input id="attachdata" type="text" name="AngehängteDaten" /><br /><br />
- <h3><u>Gewünschte Veredlungsart</u></h3><br />
- <input id="schneide-flock" type="checkbox" name="schneide-flock" />
- <span><label for="schneide-flock">Bedruckung mit <strong>Schneide-Flock</strong> (geeignet für Schriften & Vektorlogos)</label></span><br />
- <input id="schneide-flex" type="checkbox" name="schneide-flex" />
- <span><label for="schneide-flex">Bedruckung mit <strong>Schneide-Flex</strong> (geeignet für Schriften & Vektorlogos)</label></span><br />
- <input id="solventflex" type="checkbox" name="solventflex" />
- <span><label for="solventflex">Bedruckung mit <strong>Solventflex</strong> (geeignet für Schriften & Bilder/Fotos, Vektor- & Pixeldaten)</label></span><br />
- <input id="bestickung" type="checkbox" name="bestickung" />
- <span><label for="bestickung"><strong>Bestickung</strong> in unserer hauseigenen Stickerei</label></span><br />
- <h3><u>Mögliche Veredelungspositionen:</u></h3>
- <input id="brustlogo" type="checkbox" name="brustlogo" />
- <span><label for="brustlogo"><strong>Brustlogo</strong></label></span>
- <input id="brustlogo-links" type="checkbox" name="brustlogo-links" />
- <span><label for="brustlogo-links">links</label></span>
- <input id="brustlogo-rechts" type="checkbox" name="brustlogo-rechts" />
- <span><label for="brustlogo-rechts">rechts</label></span><br />
- <input id="kragenlogo" type="checkbox" name="kragenlogo" />
- <span><label for="kragenlogo"><strong>Kragenlogo</strong></label></span>
- <input id="kragenlogo-links" type="checkbox" name="kragenlogo-links" />
- <span><label for="kragenlogo-links">links</label></span>
- <input id="kragenlogo-rechts" type="checkbox" name="kragenlogo-rechts" />
- <span><label for="kragenlogo-rechts">rechts</label></span><br />
- <input id="rückenlogo" type="checkbox" name="rückenlogo" />
- <span><label for="rückenlogo"><strong>Rückenlogo</strong></label></span><br />
- <span><label for="rückenlogo-position"><strong>folgende Position anbieten</strong></label></span>
- <input id="rückenlogo-position" type="text" name="rückenlogo-position" /><br /><br />
- <span><label for="ihre-frage"><strong>Ihre Fragen:</strong></label></span><br />
- <textarea id="ihre-frage" style="resize:none;"></textarea><br />
- <h3>Ihr Kostenvoranschlag wird schnellstmöglich durch unseren Sachbearbeiter erstellt!</h3>
- </form>
- </body>
- </html>
Dazu gibt es noch eine senden.php und einen Ordner includes mit einer functions.php. Wenn Ihr das Formular mal selber in eine HTML Datei schreibt und mit Firefox o.ä. öffnet, seht ihr das ich an einer Stelle ein Bild hochladen möchte, das ganze soll das per Email verschickt werden.
Leider habe ich wenige Kentnisse in PHP um das komplett alleine zu schreiben..
Kann mir jemand helfen? Bis jetzt sehen meine PHP Dateien so aus:
senden.php:
PHP-Quellcode
- <?php
- error_reporting(E_ALL);
- ini_set('display_errors', 1);
- include ("includes/functions.php");
- $koerper = erstellekoerper($_POST["freitext"]);
- $kopf = erstellekopf ("email@email.de" ,$koerper, "BBB", "text.txt");
- var_dump ($kopf);
- $erfolg = mail ( $_POST["email"] , $_POST["betreff"] , $koerper, $kopf);
- if ($erfolg === true) {
- echo 'Sendung erfolgreich!';
- } else {
- echo 'Sendung fehlgeschlagen.';
- }
- ?>
includes/functions.php:
PHP-Quellcode
- <?php
- function erstellekopf($absender, $text, $typ, $datei) {
- $anhang = fread(fopen(dirname(dirname(__FILE__)) . '/' . $datei, "r"), filesize($datei));
- $anhang = chunk_split(base64_encode($anhang));
- $boundary = md5(uniqid(time()));
- $kopf = "MIME-Version: 1.0\n";
- $kopf .= "From: Sign-Line <" . $absender . ">" . "\n";
- $kopf .= "Content-Type: multipart/mixed; boundary=" . $boundary . "\n\n";
- $kopf .= "--" . $boundary . "\n";
- $kopf .= "Content-Type: text/html; charset=ISO-8859-1 \n";
- $kopf .= "Content-Transfer-Encoding: 8bit\n\n";
- $kopf .= $text . "\n";
- $kopf .= "--" . $boundary . "\n";
- $kopf .= 'Content-Type: text/plain; name=' . $datei . "\n";
- $kopf .= "Content-Transfer-Encoding: base64\n";
- $kopf .= 'Content-Disposition: attachment; filename=' . $datei . "\n\n";
- $kopf .= $anhang . "\n";
- $kopf .= "--" . $boundary . "--\n";
- return $kopf;
- }
- function erstellekoerper($inhalt) {
- $mailtext = '<html>
- <head>
- <title>HTML-E-Mail mit PHP erstellen</title>
- </head>
- <body>
- <div style="width:600px;background-color:red;height:100px;">Slogan</div>
- <div style="width:600px;background-color:white;">' . $inhalt . '</div>
- <div style="width:600px;background-color:red;height;100px;">Kontaktdaten</div>
- </body>
- </html>
- ';
- return $mailtext;
- }
- ?>
Danke im Vorraus,
sn0w