|
 384.6 Кб |
|
| Предоставленная форма 100% рабочая.
Помогите переделать 2-е строчки: 1. Ваш сайт(на обыкновенную строчку) и 2. Тема письма (на разделение 1вариант и 2вариант через select).
В заранее благодарен!
[code]<?php
//IMPORTANT!!
//Put in your email address below:
$to = '******@mail.ru';
//User info (DO NOT EDIT!)
$name = stripslashes($_POST['name']); //sender's name
$email = stripslashes($_POST['email']); //sender's email
$website = stripslashes($_POST['website']); //sender's website
//The subject
$subject = "[LightFormX Contact Form] "; //The default subject. Will appear by default in all messages. Change this if you want.
$subject .= stripslashes($_POST['subject']); // the subject
//The message you will receive in your mailbox
//Each parts are commented to help you understand what it does exaclty.
//YOU DON'T NEED TO EDIT IT BELOW BUT IF YOU DO, DO IT WITH CAUTION!
$msg = "From : $name \r\n"; //add sender's name to the message
$msg .= "e-Mail : $email \r\n"; //add sender's email to the message
$msg .= "Website : $website \r\n"; //add sender's website to the message
$msg .= "Subject : $subject \r\n\n"; //add subject to the message (optional! It will be displayed in the header anyway)
$msg .= "---Message--- \r\n".stripslashes($_POST['message'])."\r\n\n"; //the message itself
//Extras: User info (Optional!)
//Delete this part if you don't need it
//Display user information such as Ip address and browsers information...
$msg .= "---User information--- \r\n"; //Title
$msg .= "User IP : ".$_SERVER["REMOTE_ADDR"]."\r\n"; //Sender's IP
$msg .= "Browser info : ".$_SERVER["HTTP_USER_AGENT"]."\r\n"; //User agent
$msg .= "User come from : ".$_SERVER["HTTP_REFERER"]; //Referrer
// END Extras
?>
<head>
<title>Форма обратной связи</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="Ajax Contact form using CheckForm2 and NiceForms." />
<meta name="keywords" content="php, contact form, Ajax, mootools, checkform2, niceforms, Moo Floor, class, javascript, spamcheck, badboy.ro" />
<meta name="author" content="Jeremie Tisseau" />
<link rel="stylesheet" href="main.css" type="text/css" media="screen" />
<script type="text/javascript" src="mootools.js"></script>
<script type="text/javascript" src="formcheck.js"></script>
<script type="text/javascript">
window.addEvent('domready', function(){check = new FormCheck('third', {
display : {
fadeDuration : 500,
errorsLocation : 1,
indicateErrors : 1,
showErrors : 1
}
})});
</script>
<script type="text/javascript" src="niceforms.js"></script>
</style>
</head>
<body>
<!-- The contact form starts here-->
<?php
if ($_SERVER['REQUEST_METHOD'] != 'POST'){
$self = $_SERVER['PHP_SELF'];
?>
<!-- Start HTML form -->
<form name="form" method="post" id="third" action="<?php echo $self;?>" class="niceform">
<h1>Форма обратной связи</h1>
<!-- Name -->
<label for="name"><strong><span class="blue">*</span> Имя : </strong></label>
<input id="name" name="name" type="text" class="validate['required','length[3,-1]','nodigit']" size="20" />
<!-- Email -->
<label for="email"><strong><span class="blue">*</span> Email : </strong></label>
<input id="email" name="email" type="text" class="validate['required','length[5,-1]','email']" size="20" />
<!-- Website -->
<label for="site">Ваш сайт : </label>
<input id="website" name="website" type="text" class="validate['url']" size="20" />
<!-- Subject -->
<label for="subject"><strong><span class="blue">*</span> Тема письма: </strong></label>
<input id="subject" name="subject" type="text" class="validate['required']" size="20" />
<!-- Message -->
<label for="msg"><strong><span class="blue">*</span> Ваше сообщение : </strong></label><br />
<textarea id="message" name="message" type="text" class="validate['required']" rows="10" cols="30"></textarea>
<!-- Spam Check -->
<label for="spamcheck"><span class="blue">*</span> <acronym title="[ Spam prevention ]"><strong>Докажи что ты человек</acronym> : <span class="blue">2 + 3 = ???</span></strong></label>
<input id="spamcheck" name="spamcheck" type="text" size="5" class="validate['required','number','spamcheck']" />
<br /><br />
<input type="submit" class="buttonSubmit" value="Send it!" />
<!-- Niceforms: mouse over effect -->
<!-- Do not remove the line below -->
<div id="stylesheetTest"></div>
</form>
<?php
} else {
error_reporting(0);
if (mail($to, $subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n"))
//Message sent!
//It the message that will be displayed when the user click the sumbit button
//You can modify the text if you want
echo nl2br("
<div class=\"MsgSent\">
<h1>Поздравляем!</h1>
<p>Спасибо <b><?=$name;?></b>, ваше сообщение отправлено!<br /> Как только оно будет обработано вы получите ответ.</p>
</div>
");
else
// Display error message if the message failed to send
echo "
<div class=\"MsgError\">
<h1>Ошибка!!</h1>
<p>Извините <b><?=$name;?></b>, ваше сообщение не отправлено. Попробуйте отправить его позже!</p>
</div>";
}
?>
</body>
</html>
| [/code] | |
|
|
|
|
|
|
|
для: r-dima-s
(25.09.2009 в 21:26)
| | для e-mail(классы и стили сами вставите это не сложно):
<select name="email">
<option value="Тема1">Тема1</option>
<option value="Тема2">Тема2</option>
</select>
|
С полем Ваш сайт не много не понятно(итак вроде обыкновенная строка) или что вам нужно? | |
|
|
|
|
|
|
|
для: tvv123456
(25.09.2009 в 22:23)
| | Порбовал но без результатно строка пустая получается! | |
|
|
|
|
|
|
|
для: r-dima-s
(25.09.2009 в 22:26)
| | точно в таком варианте пробовал? У меня дак вроде все работает норм(протестил на локальном хостинге(разумеется без ява скритпа и вашего цсс))
Чем-то мне вообще не нравиться этот скрипт(не красивый он какой-то :))) | |
|
|
|
|
|
|
|
для: tvv123456
(25.09.2009 в 22:34)
| | Файл в полном объеме прикреплен сверхуу.... | |
|
|
|
|
|
|
|
для: r-dima-s
(25.09.2009 в 22:49)
| | Пришли свой вариант протестенный... | |
|
|
|
|
|
|
|
для: r-dima-s
(25.09.2009 в 22:49)
| | Ну он почти ничем не отличается но все же если тебе так надо(советовал бы я тебе нормальный скрипт для отпарвки сообщений написать):
<?php
//IMPORTANT!!
//Put in your email address below:
$to = '******@mail.ru';
//User info (DO NOT EDIT!)
$name = stripslashes($_POST['name']); //sender's name
$email = stripslashes($_POST['email']); //sender's email
$website = stripslashes($_POST['website']); //sender's website
//The subject
$subject = "[LightFormX Contact Form] "; //The default subject. Will appear by default in all messages. Change this if you want.
$subject .= stripslashes($_POST['subject']); // the subject
//The message you will receive in your mailbox
//Each parts are commented to help you understand what it does exaclty.
//YOU DON'T NEED TO EDIT IT BELOW BUT IF YOU DO, DO IT WITH CAUTION!
$msg = "From : $name \r\n"; //add sender's name to the message
$msg .= "e-Mail : $email \r\n"; //add sender's email to the message
$msg .= "Website : $website \r\n"; //add sender's website to the message
$msg .= "Subject : $subject \r\n\n"; //add subject to the message (optional! It will be displayed in the header anyway)
$msg .= "---Message--- \r\n".stripslashes($_POST['message'])."\r\n\n"; //the message itself
//Extras: User info (Optional!)
//Delete this part if you don't need it
//Display user information such as Ip address and browsers information...
$msg .= "---User information--- \r\n"; //Title
$msg .= "User IP : ".$_SERVER["REMOTE_ADDR"]."\r\n"; //Sender's IP
$msg .= "Browser info : ".$_SERVER["HTTP_USER_AGENT"]."\r\n"; //User agent
$msg .= "User come from : ".$_SERVER["HTTP_REFERER"]; //Referrer
// END Extras
?>
<head>
<title>Форма обратной связи</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="Ajax Contact form using CheckForm2 and NiceForms." />
<meta name="keywords" content="php, contact form, Ajax, mootools, checkform2, niceforms, Moo Floor, class, javascript, spamcheck, badboy.ro" />
<meta name="author" content="Jeremie Tisseau" />
<link rel="stylesheet" href="main.css" type="text/css" media="screen" />
<script type="text/javascript" src="mootools.js"></script>
<script type="text/javascript" src="formcheck.js"></script>
<script type="text/javascript">
window.addEvent('domready', function(){check = new FormCheck('third', {
display : {
fadeDuration : 500,
errorsLocation : 1,
indicateErrors : 1,
showErrors : 1
}
})});
</script>
<script type="text/javascript" src="niceforms.js"></script>
</style>
</head>
<body>
<!-- The contact form starts here-->
<?php
if ($_SERVER['REQUEST_METHOD'] != 'POST'){
$self = $_SERVER['PHP_SELF'];
?>
<!-- Start HTML form -->
<form name="form" method="post" id="third" action="<?php echo $self;?>" class="niceform">
<h1>Форма обратной связи</h1>
<!-- Name -->
<label for="name"><strong><span class="blue">*</span> Имя : </strong></label>
<input id="name" name="name" type="text" class="validate['required','length[3,-1]','nodigit']" size="20" />
<!-- Email -->
<label for="email"><strong><span class="blue">*</span> Email : </strong></label>
<select name="email">
<option value="Тема1">Тема1</option>
<option value="Тема2">Тема2</option>
</select>
<!-- Website -->
<label for="site">Ваш сайт : </label>
<input id="website" name="website" type="text" class="validate['url']" size="20" />
<!-- Subject -->
<label for="subject"><strong><span class="blue">*</span> Тема письма: </strong></label>
<input id="subject" name="subject" type="text" class="validate['required']" size="20" />
<!-- Message -->
<label for="msg"><strong><span class="blue">*</span> Ваше сообщение : </strong></label><br />
<textarea id="message" name="message" type="text" class="validate['required']" rows="10" cols="30"></textarea>
<!-- Spam Check -->
<label for="spamcheck"><span class="blue">*</span> <acronym title="[ Spam prevention ]"><strong>Докажи что ты человек</acronym> : <span class="blue">2 + 3 = ???</span></strong></label>
<input id="spamcheck" name="spamcheck" type="text" size="5" class="validate['required','number','spamcheck']" />
<br /><br />
<input type="submit" class="buttonSubmit" value="Send it!" />
<!-- Niceforms: mouse over effect -->
<!-- Do not remove the line below -->
<div id="stylesheetTest"></div>
</form>
<?php
} else {
error_reporting(0);
if (mail($to, $subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n"))
//Message sent!
//It the message that will be displayed when the user click the sumbit button
//You can modify the text if you want
echo nl2br("
<div class=\"MsgSent\">
<h1>Поздравляем!</h1>
<p>Спасибо <b><?=$name;?></b>, ваше сообщение отправлено!<br /> Как только оно будет обработано вы получите ответ.</p>
</div>
");
else
// Display error message if the message failed to send
echo "
<div class=\"MsgError\">
<h1>Ошибка!!</h1>
<p>Извините <b><?=$name;?></b>, ваше сообщение не отправлено. Попробуйте отправить его позже!</p>
</div>";
}
?>
</body>
</html>
|
| |
|
|
|
|
|
|
|
для: tvv123456
(25.09.2009 в 22:52)
| | Благодарю... | |
|
|
|
|
|
|
|
для: r-dima-s
(25.09.2009 в 22:54)
| | работает? | |
|
|
|
|
|
|
|
для: tvv123456
(25.09.2009 в 22:55)
| | Проверю отпишу, на хосте проблемы пока... | |
|
|
|
|
|
|
|
для: r-dima-s
(25.09.2009 в 23:03)
| | Начала работать...
Спасибо. | |
|
|
|