Moin,
mit Hilfe von etlichen Formmailern und SELFHTML habe ich mir ein reines PHP-Formular gebastelt.
Bedingungen waren: PHP, Dropdown-Felder, ein Upload-Feld und das ganze sollte an eine Email Adresse gesendet werden.
Klappt soweit ganz gut, außer das in der Mail das Dropdown-Feld mit einer 0 gesendet wird und das Upload-Feld funzt nicht.
Ich notiere hier mal den relevanten Auszug des Scripts. Vielleicht kommt von Euch jemand dahinter.......
Alles anzeigen
Gruß, Krischan
mit Hilfe von etlichen Formmailern und SELFHTML habe ich mir ein reines PHP-Formular gebastelt.
Bedingungen waren: PHP, Dropdown-Felder, ein Upload-Feld und das ganze sollte an eine Email Adresse gesendet werden.
Klappt soweit ganz gut, außer das in der Mail das Dropdown-Feld mit einer 0 gesendet wird und das Upload-Feld funzt nicht.
Ich notiere hier mal den relevanten Auszug des Scripts. Vielleicht kommt von Euch jemand dahinter.......
Quellcode
- <?php
- $strEmpfaenger = 'empfaenger@domain.de';
- $strFrom = '"Artikelerstellung" <absender@domain.de>';
- $strSubject = 'neuer Artikel';
- $strReturnhtml = 'http://www.test.de/artikel.php';
- $strDelimiter = ":\t";
- if($_POST)
- {
- if($_POST['Shopname'])
- {
- $strMailtext = "";
- while(list($strName,$value) = each($_POST))
- {
- if(is_array($value))
- {
- foreach($value as $value_array)
- {
- $strMailtext .= $strName.$strDelimiter.$value_array."\n";
- }
- }
- else
- {
- $strMailtext .= $strName.$strDelimiter.$value."\n";
- }
- }
- }
- else die('Sie haben den Shopnamen vergessen');
- if(get_magic_quotes_gpc())
- {
- $strMailtext = stripslashes($strMailtext);
- }
- mail($strEmpfaenger, $strSubject, $strMailtext, "From: ".$strFrom)
- or die("Die Mail konnte nicht versendet werden.");
- header("Location: $strReturnhtml");
- exit;
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
- <meta http-equiv="content-language" content="de-DE" />
- <title>Artikelerstellung</title>
- <link href="css/form.css" rel="stylesheet" type="text/css" />
- <link rel="stylesheet" TYPE="text/css" href="style.css" media="screen" />
- <meta http-equiv="Page-Enter" content="RevealTrans(Duration=2,Transition=12)" />
- <meta http-equiv="Page-Exit" content="RevealTrans(Duration=2,Transition=12)" />
- </head>
- <body>
- <div id="main_schatten">
- <div id="inner">
- <div id="urltext"><a href="index.html" class="navigurl" title="zurück zur Hauptseite...">index » </a>Eingabe</div>
- <form enctype="multipart/form-data" action="<?php echo htmlspecialchars ($_SERVER['PHP_SELF']); ?>" method="post">
- <!-- *** SHOPNAME: *** -->
- <div style="position:absolute;left:10px;top:44px;width:180px;height:18px;font:0.8em Trebuchet MS,Arial;font-weight:normal;font-style:normal;text-decoration:none;color:#D8D8D8;background:transparent;">Artikeleingabe für Online-Shop</div>
- <input type="text" name="Shopname" style="position:absolute;left:200px;top:44px;width:150px;height:14px;font:0.8em Trebuchet MS,Arial;font-weight:normal;font-style:normal;text-decoration:none;color:#000000;background:#D8D8D8;border: 1px solid #000000;" />
- <!-- *** GESCHMACK *** -->
- <div style="position:absolute;left:426px;top:236px;width:72px;height:18px;font:0.8em Trebuchet MS,Arial;font-weight:normal;font-style:normal;text-decoration:none;color:#D8D8D8;background:transparent;">Geschmack</div>
- <select name="Geschmack" style="position:absolute;left:502px;top:234px;width:102px;height:21px;font:0.8em Trebuchet MS,Arial;font-weight:normal;font-style:normal;text-decoration:none;color:#000000;background:#D8D8D8;border: 1px solid #000000;">
- <?php
- $selected = ($idx == '0') ? 'selected="selected"' : '';
- echo("\n".'<option value="0" '.$selected.'>wählen</option>');
- $selected = ($idx == '1') ? 'selected="selected"' : '';
- echo("\n".'<option value="1" '.$selected.'>trocken</option>');
- $selected = ($idx == '2') ? 'selected="selected"' : '';
- echo("\n".'<option value="2" '.$selected.'>halbtrocken</option>');
- ?></select>
- <!-- *** UPLOADFELD *** -->
- <div style="position:absolute;left:10px;top:409px;width:188px;height:18px;font:0.8em Trebuchet MS,Arial;font-weight:normal;font-style:normal;text-decoration:none;color:#D8D8D8;background:transparent;">Artikelbild oder Datei hochladen:</div>
- <input type="file" name="senden" style="position:absolute;left:221px;top:408px;width:384px;height:20px;font:0.8em Trebuchet MS,Arial;font-weight:normal;font-style:normal;text-decoration:none;color:#000000;background:#D8D8D8;border: 1px solid #000000;" />
- </form>
- </div>
- </div>
- </body>
- </html>
Gruß, Krischan