|
|
Kein Plan von Php
So habe von Php keine Ahnung (wie mein Name schon sagt 
)
Nun brauche ich ein recht simples Script.
Jmd. gibt seinen Namen in das Eingabefeld und zack wird mir das per emial geschickt.
Mit Html habe ich das hinbekommen doch da muss man ja einen Email clienten installiert haben und das möchte ich grade verhindern.
Kann mir jmd. ein Script anfertigen?
Soll 1 Textfeld sein wo man seinen Namen eingibt dann auf senden drückt und ich es per Mail bekommen.
Thx
TrioxX
Okay, dann wollen wir mal...
HTML (script.html):
| code: |
1:
2:
3:
4:
5:
|
<form name="form" method="POST" action="script.php">
<input type="text" name="name" value="" />
<br />
<input type="submit" name="submit" value="Absenden" />
</form> |
|
-------
PHP (script.php):
| php: |
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:
|
<?
// Ändern
$email = "irgendwer@irgendwas.tld";
$betreff = "Email";
// Ab hier nichts mehr ändern
$submit = $_POST['submit'];
$name = $_POST['name'];
if($submit == "submit" && !empty($name))
{
$text = "Du hast eine E-Mail von ".$name." erhalten :)";
if(@mail($email, $betreff, $text, "From: $email <$email>"))
{
echo "Die E-Mail wurde erfolgreich versandt!";
}
else
{
echo "Fehler beim Versenden der E-Mail!";
}
}
else
{
echo "Bitte fülle alle Felder aus und versuche es erneut!";
}
?> |
|
Und fertig ist das Mondgesicht
Das Ganze ist natürlich "very basical" und enthält lediglich eine Prüfung, ob der Senden Button geklickt und ein Name eingegeben wurde.
Wobei auch noch eine Abfrage stattfindet, ob der Mailversand erfolgreich war, oder nicht.
Etwaige Zeichenfilter, Erweiterungen usw. sollten noch integriert werden. Aber zur Veranschaulichung reicht das
Kein Plan von Php
Mehr brauch es eigentlich auch nicht ausser vllt. noch ein Spamschutz
Wenn ich jetzt was eingebe z.b Name email etc. kommt der Error ich solle die Felder ausfüllen und es erneut versuchen.
TrioxX
Dann mach mal das @ bitte weg und schau, welche Fehlermeldung dann angezeigt wird.
TrioxX
Ersetz den Inhalt der script.php mal bitte durch:
| php: |
1:
2:
3:
|
<?
var_dump($_POST);
?> |
|
TrioxX
Okay, war mein Fehler
| php: |
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:
|
<?
// Ändern
$email = "irgendwer@irgendwas.tld";
$betreff = "Email";
// Ab hier nichts mehr ändern
$submit = $_POST['submit'];
$name = $_POST['name'];
if($submit == "Absenden" && !empty($name))
{
$text = "Du hast eine E-Mail von ".$name." erhalten :)";
if(@mail($email, $betreff, $text, "From: $email <$email>"))
{
echo "Die E-Mail wurde erfolgreich versandt!";
}
else
{
echo "Fehler beim Versenden der E-Mail!";
}
}
else
{
echo "Bitte fülle alle Felder aus und versuche es erneut!";
}
?> |
|
Kein Plan von Php
Ahh 
Thx
Jetzt muss nur noch in mein fuck design einbauen welches nicht so will wieich will
Kein Plan von Php
Sry für Doppelpost.
Aber wie mache ich das Script für Firefox kompatibel?
In IE sieht alles super aus doch in FF hängt das Script mitten im Text :/
Edit: In Opera funktioniert es auch nicht.
TrioxX
Das liegt an deiner Seite, nicht an dem Script
Kein Plan von Php
Na Toll dann muss ich meine Seite ja doch nochmal übergucken, dachte jezz sind alle Bugs weg und dann hochgeladen. Shit FF und Opera zeigens falsch an
| code: |
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:
|
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
New Homepage
</title>
<link rel="stylesheet" href="css.css" type="text/css" />
</head>
<body>
<div id="center">
<a href="index.html"> <img src="images/home.gif" /> </a>
<a href="impressum.html"> <img src="images/impressum.gif" /> </a>
<a href="ptz.html"> <img src="images/punkte.gif" /> </a>
<div id="layout">
<p id="text">
<b><u> Question </u></b>
<br>
<br>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer.
<br>
<br>
<br>
Enter your answer.
<br>
<form name="form" method="POST" action="script.php">
<input type="text" name="name" value="" />
<br />
<input type="submit" name="submit" value="Absenden" />
</form>
</p>
</div>
</div>
</div>
</body>
</html>
|
|
| code: |
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:
|
#center
{
width:990px;
margin:0 auto;
min-height:396px;
}
body
{
background-color: #190923;
}
#layout
{
background-image: url(images/layout.png);
width: 697px;
height: 790px;
}
p#text
{
position: relative;
width: 597px;
margin: 0 0 0 50px;
color: #f4db81;
top: 200px;
}
|
|
Also ich verstehe nicht was ich falsch mache das FF und Opera es nicht verstehen?! :/
TrioxX
HTML:
| code: |
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:
|
<!DOCTYPE html PUBLIC"-// W3C//DTD XHTML 1.0 Transitional//EN"" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
New Homepage
</title>
<link rel="stylesheet" href="css.css" type="text/css"/>
</head>
<body>
<div id="center">
<a href="index.html"><img src="images/home.gif" alt="Home"/></a>
<a href="impressum.html"><img src="images/impressum.gif" alt="Impressum"/></a>
<a href="ptz.html"><img src="images/punkte.gif" alt="Punkte"/></a>
<div id="layout">
<span id="text">
<b>
<u> Question
</u>
</b>
<br/>
<br/>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer.
<br/>
<br/>
<br/>
Enter your answer.
<br/>
<form name="form" method="post" action="script.php">
<input type="text" name="name" value=""/>
<br/>
<input type="submit" name="submit" value="Absenden"/>
</form>
</span>
</div>
</div>
</body>
</html> |
|
CSS:
| code: |
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:
|
#center
{
width:990px;
margin:0 auto;
min-height:396px;
}
body
{
background-color: #190923;
}
#layout
{
background-image: url(images/layout.png);
width: 697px;
height: 790px;
}
#text
{
position: relative;
width: 597px;
margin: 0 0 0 50px;
color: #f4db81;
top: 200px;
}
|
|
Ungetestet, sollte aber gehen. Zudem hab ich mir erlaubt, das Ganze mal valid zu gestalten, aber auch das hab ich noch nicht geprüft.
Schau einfach mal nach, ob alles so passt.
Ich werde das Thema dann entsprechend in die HTML-Ecke verschieben.
Kein Plan von Php
Valid ist mist :/
Habe mir das jetzt anders angewöhnt da ich finde man so besseren Überblick hat
Hmm du hast jetzt
| code: |
1:
2:
3:
|
<span id="text">
|
|
Dann geht das mit dem Text nicht
Ahh ...
Bin so blöd :/
Jetzt funktioniert es
habe vergessen in der CSS das "p#text" zu ändern
Danke dir vielmals
edit: jetzt lässt sich die textbreite nicht mehr ändern -.-
TrioxX
Mach aus dem Span ein Div und dann sollte das Problem gelöst sein.
TrioxX
Kleine Anmerkung am Rande: Valid heißt NICHT, dass der Quelltext schön geordnet sein muss. Das mache ich von Haus aus
Vald heißt, dass der Code mit allen gängigen Browsern kompatibel ist
|
|