Hallo!
Folgendes prob: ich habe hier ein formular und unten per javascript den befehl "javascript
:document.emailform.submit()". allerdings reloaded er das formular immer wieder, anstatt es abzuschicken. wenn ich stattdessen einen button einbaue, wie folgt:
<input type="Submit" name="submit" value="Formular abschicken">,
dann funktioniert es ohne probleme. hat jemand von euch ne idee, bzw. lösung?
<?
$HTTP_GET_VARS["link"];
$baseURL = "http://www.xxx.de";
$subject = "Weiterempfehlung";
// Overrides GPC variables if magic_quotes is turned on
if (get_magic_quotes_gpc()) {
for (reset($HTTP_GET_VARS); list($k, $v) = each($HTTP_GET_VARS); )
$$k = stripslashes($v);
for (reset($HTTP_POST_VARS); list($k, $v) = each($HTTP_POST_VARS); )
$$k = stripslashes($v);
for (reset($HTTP_COOKIE_VARS); list($k, $v) = each($HTTP_COOKIE_VARS); )
$$k = stripslashes($v);
}
if (!$submit) {
echo "<body bgcolor="#059965">
<form name="emailform" action="" method="post">
<input type="hidden" value="$link" name="link">
<center>
<table border="0" cellpadding="0" cellspacing="2" width="378">
<tr>
<td width="160"><font color="white" face="Verdana" size="2">Name Empfänger:</font> <font size="2" color="black">*</font></td>
<td width="198"><input type="Text" name="txtFriendName" size="25" maxlength="40" value=""></td>
</tr>
<tr>
<td width="160"><font color="white" face="Verdana" size="2">E-Mail Empfänger:</font> <font size="2" color="black">*</font></td>
<td width="198"><input type="Text" name="txtFriendEmail" size="25" maxlength="40" value=""></td>
</tr>
<tr>
<td width="160"><font color="white" face="Verdana" size="2">Ihr Name:</font> <font size="2" color="black">*</font></td>
<td width="198"><input type="Text" name="txtName" size="25" maxlength="40" value=""></td>
</tr>
<tr>
<td width="160"><font color="white" face="Verdana" size="2">Ihre E-Mail-Adresse:</font> <font size="2" color="black">*</font></td>
<td width="198"><input type="Text" name="txtEmail" size="25" maxlength="40" value=""></td>
</tr>
<tr>
<td width="160" valign="top"><font color="white" face="Verdana" size="2">Ihre persönliche Mitteilung:</font></td>
<td width="198"><Textarea name="txtComments" cols="21" rows="5" value=""></textarea></td>
</tr>
<tr>
<td width="160"><a href="javascript
:document.emailform.submit()"><font color="white" face="Verdana" size="2"><b>Formular abschicken</b></font></a></td>
<td width="198"><a href="javascript
:document.emailform.reset()"><font color="white" face="Verdana" size="2"><b>Formular zurücksetzen</b></font></a></td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="2"><font face="Verdana" size="1" color="white">Die mit</font> <font color="black">*</font> <font color="white" face="Verdana" size="1">gekennzeichneten Felder müssen ausgefüllt werden.</font></td>
</tr>
</table>
</center>
</form>
";
}
else {
if (!preg_match ("/[w-]+@[w-]+.[w-]+/", $txtEmail)) {
$strBadInput = "Your e-mail address is invalid";
}
elseif (!preg_match ("/[w-]+@[w-]+.[w-]+/", $txtFriendEmail)) {
$strBadInput = "The recipient e-mail address is invalid.";
}
elseif (!preg_match ("/[A-Z]/i", $txtName)) {
$strBadInput = "You must supply your name.";
}
elseif (!preg_match ("/[A-Z]/i", $txtFriendName)) {
$strBadInput = "You must supply your friend's name.";
}
if ($strBadInput) {?>
<?
header("Location:
http://www.xxx.de");
?>
<?
}
else {
$url = $link;
$strBody = "n$txtName hat uns gebeten, Ihnen diese Empfehlung zu schicken.nnMit freundlichen GrüssennnIhr Team von xxxnn------------------------------------------------------------nn";
$strBody .= "Persönliche Mitteilung:nnHallo $txtFriendName,nn$txtCommentsnnEinfach diesen Link anklicken: $url.";
mail("$txtFriendName <$txtFriendEmail>",$subject,$strBody,"From:$txtName <$txtEmail>");?>
<?
header("Location:
http://www.xxx.de");
?>
<?
}
}
?>
Schonmal besten dank!
olbman