Poprawiłem, dodałem część odpowiedzialną za generowanie unikalnego kodu (numeru formularza)
$znaki = 'abcdefghijk1234567890'; // tutaj wymieniasz wszystkie mozliwe znaki
$znaki_c = count($znaki); // ilosc znakow $kod='';
for($i=0; $i<15; $i++){
$kod.=$znaki[rand(0
,$znaki_c-1
)]; // tworzenie kodu }
i calość ma być wysyłana na mail jaki podaje user w formularzu (no i do mnie oczywiście)
mail($message, $subject, $body, $header, $kod);
niestety nie działa - co zawalilem?, proszę o pomoc...
cały kod:
<?php
function ValidateEmail($email)
{
$pattern = '/^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i';
}
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$mailto = 'moj_email@o2.pl';
$mailfrom = isset($_POST['email']) ?
$_POST['email'] : $mailto; $subject = 'Website form';
$message = 'Values submitted from web site form:';
$success_url = '';
$error_url = '';
$error = '';
$eol = "\n";
$max_filesize = isset($_POST['filesize']) ?
$_POST['filesize'] * 1024
: 1024000;
$header = 'From: '.$mailfrom.$eol;
$header .= 'Reply-To: '.$mailfrom.$eol;
$header .= 'MIME-Version: 1.0'.$eol;
$header .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'.$eol;
if (!ValidateEmail($mailfrom))
{
$error .= "The specified email address is invalid!\n<br>";
}
{
$replace = "##error##";
$errorcode = str_replace($replace, $error, $errorcode); }
$internalfields = array ("submit", "reset", "send", "captcha_code"); $message .= $eol;
$message .= "IP Address : ";
$message .= $_SERVER['REMOTE_ADDR'];
$message .= $eol;
foreach ($_POST as $key => $value)
{
{
{
}
else
{
}
}
}
$znaki = 'abcdefghijk1234567890'; // wszystkie mozliwe znaki
$znaki_c = count($znaki); // ilosc znakow $kod='';
for($i=0; $i<15; $i++){
$kod.=$znaki[rand(0
,$znaki_c-1
)]; // tworzenie kodu }
$body = 'This is a multi-part message in MIME format.'.$eol.$eol;
$body .= '--'.$boundary.$eol;
$body .= 'Content-Type: text/plain; charset=ISO-8859-1'.$eol;
$body .= 'Content-Transfer-Encoding: 8bit'.$eol;
{
foreach ($_FILES as $key => $value)
{
if ($_FILES[$key]['error'] == 0 && $_FILES[$key]['size'] <= $max_filesize)
{
$body .= '--'.$boundary.$eol;
$body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol;
$body .= 'Content-Transfer-Encoding: base64'.$eol;
$body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol;
}
}
}
$body .= '--'.$boundary.'--'.$eol;
mail($mailto, $subject, $body, $header, $kod); mail($message, $subject, $body, $header, $kod); header('Location: '.$success_url); }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Lapu</title>
<meta name="generator" content="Lapu">
<style type="text/css">
body
{
background-color: #FFFFFF;
color: #000000;
}
</style>
<style type="text/css">
p, span, div, ol, ul, li, td, button, input, textarea, form
{
margin: 0;
padding: 0;
}
a
{
color: #C8D7EB;
outline: none;
text-decoration: underline;
}
a:visited
{
color: #C8D7EB;
}
a:active
{
color: #C8D7EB;
}
a:hover
{
color: #376BAD;
text-decoration: underline;
}
</style>
<link rel="stylesheet" href="./wb.validation.css" type="text/css">
<style type="text/css">
#wb_Form1
{
background-color: #FAFAFA;
border: 0px #000000 solid;
}
#Editbox1
{
border: 1px #C0C0C0 solid;
background-color: #FFFFFF;
color :#000000;
font-family: Arial;
font-size: 13px;
text-align: left;
vertical-align: middle;
}
#wb_Text1
{
background-color: transparent;
border: 0px #000000 solid;
padding: 0;
}
#wb_Text1 div
{
text-align: left;
}
#Button1
{
color: #000000;
font-family: Arial;
font-size: 13px;
}
</style>
<script type="text/javascript" src="./jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="./wb.validation.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#Form1").submit(function(event)
{
var isValid = $.validate.form(this);
return isValid;
});
$("#Editbox1").validate(
{
required: false,
type: 'email',
color_text: '#000000',
color_hint: '#00FF00',
color_error: '#FF0000',
color_border: '#808080',
nohint: false,
font_family: 'Arial',
font_size: '13px',
position: 'topleft',
offsetx: 0,
offsety: 0,
effect: 'none',
error_text: 'NIE WPISALES MAILA'
});
});
</script>
</head>
<body>
<div id="wb_Form1" style="position:absolute;left:75px;top:91px;width:410px;height:196px;z-index:3;">
<form name="Form1" method="post" action="
<?php echo basename(__FILE__); ?>" enctype="multipart/form-data" id="Form1">
<input type="text" id="Editbox1" style="position:absolute;left:149px;top:39px;width:167px;height:19px;line-height:19px;z-index:0;" name="Editbox1" value="">
<div id="wb_Text1" style="position:absolute;left:99px;top:42px;width:40px;height:16px;z-index:1;">
<span style="color:#000000;font-family:Arial;font-size:13px;">email</span></div>
<input type="submit" id="Button1" name="" value="Wyslij" style="position:absolute;left:98px;top:112px;width:96px;height:25px;z-index:2;">
</form>
</div>
</body>
</html>