@Resolut1on

Почему не работает файл отправки?

Добрый день скачал готовуб форму tympanus.net/codrops/2014/07/30/fullscreen-form-in... разобрал ее, стилизовал под себя и тут возникла такая проблема я не знаю языка PHP. Я пытался создать форму отравки на локальном сервера но форма не работает в папке с письмами от этой формы пиьсмо не приходит. Вот сама форма
<form id="myform" class="fs-form fs-form-full" autocomplete="off">
					<ol class="fs-fields">
						<li>
							<label class="fs-field-label fs-anim-upper" for="q1">Как вас зовут?</label>
							<input class="fs-anim-lower" id="q1" name="q1" type="text" placeholder="Петр Иванов" required/>
						</li>
						<li>
							<label class="fs-field-label fs-anim-upper" for="q2" data-info="We won't send you spam, we promise...">Какой у вас электронный адрес?</label>
							<input class="fs-anim-lower" id="q2" name="q2" type="email" placeholder="mail@mail" required/>
						</li>
						<li data-input-trigger>
							<label class="fs-field-label fs-anim-upper" for="q3" data-info="This will help us know what kind of service you need">Услуги</label>
							<div class="fs-radio-group fs-radio-custom clearfix fs-anim-lower">
								<span><input id="q3b" name="q3" type="radio" value="conversion"/><label for="q3b" class="radio-conversion">1</label></span>
								<span><input id="q3c" name="q3" type="radio" value="social"/><label for="q3c" class="radio-social">2</label></span>
								<span><input id="q3a" name="q3" type="radio" value="mobile"/><label for="q3a" class="radio-mobile">3</label></span>
							</div>
						</li>
						<li>
							<label class="fs-field-label fs-anim-upper" for="q4">Ваши пожелания к проекту</label>
							<textarea class="fs-anim-lower" id="q4" name="q4" placeholder="Describe here"></textarea>
						</li>
					</ol><!-- /fs-fields -->
					<button class="fs-submit" type="submit">Отправить</button>
				</form><!-- /fs-form -->


Вот JavaScript
<script>
			(function() {
				var formWrap = document.getElementById( 'fs-form-wrap' );

				[].slice.call( document.querySelectorAll( 'select.cs-select' ) ).forEach( function(el) {	
					new SelectFx( el, {
						stickyPlaceholder: false,
						onChange: function(val){
							document.querySelector('span.cs-placeholder').style.backgroundColor = val;
						}
					});
				} );

				new FForm( formWrap, {
					onReview : function() {
						classie.add( document.body, 'overview' ); // for demo purposes only
					}
				} );
			})();
			
			$(document).ready(function() {
			
				// process the form
				$('#myform').submit(function(event) {
					
					var formData = $('#myform').serialize();
					$(".fs-submit").prop("disabled", true);

					// process the form
					$.ajax({
						type: 'POST',
						url: 'mail.php',
						data: formData, 
						dataType: 'json',
						success: function (data) {
							onFormSuccess(data);
						}
					})
					event.preventDefault();
				});
				
				function onFormSuccess(data) {
					$('#myform').fadeOut();
					$(".form-success").fadeIn();
				}
			
			});
			
		</script>

И файл Mail.php
<?php

$recepient = "mail";
$sitename = "Название сайта";

$name = trim($_POST["q1"]);
$mail = trim($_POST["q2"]);
$service = trim($_POST["q3"]);
$desc = trim($_POST["q4"]);
$message = "Имя: $name \nEmail: $q2 \nУслуга: $q3 \nСообщение: $q4";

$pagetitle = "Новая заявка с сайта \"$sitename\"";
mail($recepient, $pagetitle, $message, "Content-type: text/plain; charset=\"utf-8\"\n From: $recepient");
  • Вопрос задан
  • 86 просмотров
Пригласить эксперта
Ответы на вопрос 2
coderisimo
@coderisimo Куратор тега JavaScript
посмотрите что пишется в консоли после попытки отправки
Ответ написан
Комментировать
felessar
@felessar
$recipient должен соответствовать формату RFC 2822. Например:
user@example.com
user@example.com, anotheruser@example.com
User <user@example.com>
User <user@example.com>, Another User <anotheruser@example.com>


Детальнее тут
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы