Autor Beitrag
storestore
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 397
Erhaltene Danke: 7

WIN 7
C#
BeitragVerfasst: So 14.08.11 15:56 
Hallo,
ich neu hier also weiß ich nicht ob es hier her gehört.
Es gibt schon ein paar Themen über php aber ich muss meinen eigenen code einfügen:

Also ich habe ein Kontakformular in php Programmiert. Wenn man auf senden geht dann soll ich die e-mail mit den entsprechenden daten bekomme. Aber das Problem ist das er mit "Name", "Produkt" und "Straße nich anzeigt. Ich bin echt verzweifelt :cry: :cry: :cry: . Ich saß gestern bis ungefährt 2.00 Uhr (Morgens) daran. Kann mir jemand vieleicht helfen. Hier ist der code :

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
<?php
/* Betreffen und Email Variable */
    $emailBetreff = 'Bestellung';
  $webmaster = 'storestore@web.de';
  
  
/* Emailforen Daten*/

  $nameFeld = $_POST['Name'];
  $nachname = $_POST['Nachname'];
  $email = $_POST['email'];
  $Ort = $_POST['Ort'];
  $PLZ = $_POST['PLZ'];
  $Starße = $_POST['Straße'];  
  $Hausnummer = $_POST['Hausnummer'];
  $Produkt = $_POST['Produkt'];
  $Produkt = $_POST['Produkt2'];
  $Produkt = $_POST['Produkt3'];
  $Notiz = $_POST['Notiz'];
  $AGB = $_POST['AGB'];
  $Datein = $_POST['Datein'];
  
  /* Was in der E-mail stehen soll */
  
  $body = <<<EOD
<br><hr><br>
Name: $Name <br>
Nachname: $Nachname <br>
Email: $email <br>
Ort: $Ort<br>
PLZ: $PLZ <br>
Straße: $Straße <br>
Hausnummer: $Hausnummer <br>
Produkt: $Produkt <br>
Produkt: $Produkt2 <br>
Produkt: $Produkt3 <br>
Notzi: $Notiz <br>
AGB: $AGB <br>
Datein:  $Datein <br>
EOD;

  $headers = "From: $email\r\n";
  $headers .= "Content-type: text/html\r\n";
  $headers  = mail($webmaster, $emailBetreff, $body, $headers);
  
/* Antwort*/
echo "Deine Bestellung wurde erfolgreich versendet. Vielen Dank!";  
  
  
  


?>
[code]



Vielen DANK im voraus :wink:


mfg storestore


Moderiert von user profile iconChristian S.: Topic aus Off Topic verschoben am So 15.07.2012 um 12:49
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 14.08.11 16:11 
Du hast die variable $Straße falsch geschrieben. Ich würde auch keine deutschen Sonderzeichen verwenden.

Und du hast drei Produkte, weißt sie aber einer Variablen zu:
ausblenden Quelltext
1:
2:
3:
$Produkt = $_POST['Produkt'];
$Produkt = $_POST['Produkt2'];
$Produkt = $_POST['Produkt3'];

Wenn Produkt3 leer ist wird am Ende auch die Variable $Produkt leer sein.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 14.08.11 16:55 
Davon ganz abgesehen benutzt du die Parameter einfach ungeprüft und unmaskiert, womit du dir eine schöne Sicherheitslücke einbaust...
storestore Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 397
Erhaltene Danke: 7

WIN 7
C#
BeitragVerfasst: So 14.08.11 17:59 
Hmmm, danke erst mal. Wie regele ich das mit den Parametern ???



mfg


Zuletzt bearbeitet von storestore am Mo 12.09.11 14:08, insgesamt 1-mal bearbeitet
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 14.08.11 18:00 
Dafür gibt es entsprechende Funktionen wie htmlentities:
php.net/manual/de/fu...ion.htmlentities.php
storestore Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 397
Erhaltene Danke: 7

WIN 7
C#
BeitragVerfasst: So 14.08.11 18:06 
Hallo, gute alles geändert (Außer Parameter) aber wie sieht es mit name (Vorname) aus wird immer nocht nicht angezeigt. Und bei Produkt zeigt er nur an wenn das erste angekreutzt ist .,.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 14.08.11 19:03 
user profile iconstorestore hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Quelltext
1:
2:
3:
  $nameFeld = $_POST['Name'];
[...]
Name: $Name <br>
storestore Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 397
Erhaltene Danke: 7

WIN 7
C#
BeitragVerfasst: So 14.08.11 22:54 
Auch schon geändert aber Produkt und name werden immer noch nicht angezeigt
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 14.08.11 23:02 
Wie sieht denn der aktuelle Code aus?

Und wie wärs mit Debuggen? Mit Debugausgaben mit echo z.B., wenn du keine Lust hast einen echten Debugger einzurichten (ist auch nicht ganz trivial).
storestore Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 397
Erhaltene Danke: 7

WIN 7
C#
BeitragVerfasst: Mo 15.08.11 00:14 
Debbuger hmmm ähh leider bin ich neu was heißt das denn

code:
ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
<?php
/* Betreffen und Email Variable */
    $emailBetreff = 'Bestellung';
  $webmaster = 'storestore@web.de';
  
  
/* Emailforen Daten*/

  $name = $_POST['name'];
  $Nachname = $_POST['Nachname'];
  $email = $_POST['email'];
  $Ort = $_POST['Ort'];
  $PLZ = $_POST['PLZ'];
  $Straße = $_POST['Strasse'];  
  $Hausnummer = $_POST['Hausnummer'];
  $Produkt = $_POST['Produkt'];
  $Produkt2 .= $_POST['Produkt2'];
  $Produkt3 .= $_POST['Produkt3'];
  $Notiz = $_POST['Notiz'];
  $AGB = $_POST['AGB'];
  $Datein = $_POST['Datein'];
  
  /* Was in der E-mail stehen soll */
  
  $body = <<<EOD
<br><hr><br>
Name: $name <br>
Nachname: $Nachname <br>
Email: $email <br>
Ort: $Ort<br>
PLZ: $PLZ <br>
Strasse: $Strasse <br>
Hausnummer: $Hausnummer <br>
Produkt1: $Produkt <br>
Produkt2: $Produkt2 <br>
Produkt3: $Produkt3 <br>
Notzi: $Notiz <br>
AGB: $AGB <br>
Datein:  $Datein <br>
EOD;

  $headers = "From: $email\r\n";
  $headers .= "Content-type: text/html\r\n";
  $headers  = mail($webmaster, $emailBetreff, $body, $headers);
  
/* Antwort*/
echo "Deine Bestellung wurde erfolgreich versendet. Vielen Dank!";  
  
  
  


?>
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 15.08.11 00:47 
Wo wird das denn abgeschickt? Kann es sein, dass du den Parameter Name dort aus Versehen groß statt wie in dem Code hier klein geschrieben hast?
storestore Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 397
Erhaltene Danke: 7

WIN 7
C#
BeitragVerfasst: Mo 15.08.11 00:58 
Hallo,
nee alles geprüft alles gleich geschrieben
storestore Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 397
Erhaltene Danke: 7

WIN 7
C#
BeitragVerfasst: Mi 17.08.11 19:04 
Ich habs danke an alle
Handycommander
ontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1054

Windows XP Pro, Vista
Visual Studio 2008
BeitragVerfasst: So 11.09.11 17:10 
Du weißt, wofür der .= Operator da ist??

ausblenden XML-Daten
1:
2:
  $Produkt2 .= $_POST['Produkt2'];
  $Produkt3 .= $_POST['Produkt3'];
storestore Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 397
Erhaltene Danke: 7

WIN 7
C#
BeitragVerfasst: So 11.09.11 20:47 
user profile iconHandycommander hat folgendes geschrieben Zum zitierten Posting springen:
Du weißt, wofür der .= Operator da ist??

ausblenden XML-Daten
1:
2:
  $Produkt2 .= $_POST['Produkt2'];
  $Produkt3 .= $_POST['Produkt3'];

Hi,
hmm das Thema ist schon lange abgeschlossen. Aber trotzdem gebe ich es zu: Ich weiß es nicht. Wozu dient er den *Zu faul sei um zu googlen* :mrgreen:
mfg storestore

_________________
Der Pc ist nur so schlau, wie derjenige der in steuert!
"Don't Quit. Suffer now, and live the rest of your life as a champion"
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 12.09.11 00:36 

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.

Für diesen Beitrag haben gedankt: storestore
storestore Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 397
Erhaltene Danke: 7

WIN 7
C#
BeitragVerfasst: Mo 12.09.11 13:41 
Ok, danke

_________________
Der Pc ist nur so schlau, wie derjenige der in steuert!
"Don't Quit. Suffer now, and live the rest of your life as a champion"