Using PHP to collect Form data doesn't work

Issues related to forms.
Post Reply
tanik.sam
 
 
Posts: 16
Joined: Fri Jul 24, 2020 5:57 am

Using PHP to collect Form data doesn't work

Post by tanik.sam »

I've tied to use the tutorial on http://www.wysiwygwebbuilder.com/forms_php.html in order to make my form send the messages on my mail. But I have nothing on my mail. I see, that my form (when I press submit) connect to feedback.php (I see answer). I know that the webserver of my hoster supports PHP.

The php code (generated automatically by WYSIWYG WB15):
<?php
$mailto = "tanik.sam@yandex.ru";
$subject = "Feedback form";
$message = "Values submitted from web site form:";
$header = "From: ".$_POST['email'];
foreach ($_POST as $key => $value)
{
if (!is_array($value))
{
$message .= "\n".$key." : ".$value;
}
else
{
foreach ($_POST[$key] as $itemvalue)
{
$message .= "\n".$key." : ".$itemvalue;
}
}
}
mail($mailto, $subject, stripslashes($message), $header);
?>

The fuL\ll code of the page with expention .php (generated automatically by WYSIWYG WB15):
<?php
$mailto = "tanik.sam@yandex.ru";
$subject = "Feedback form";
$message = "Values submitted from web site form:";
$header = "From: ".$_POST['email'];
foreach ($_POST as $key => $value)
{
if (!is_array($value))
{
$message .= "\n".$key." : ".$value;
}
else
{
foreach ($_POST[$key] as $itemvalue)
{
$message .= "\n".$key." : ".$itemvalue;
}
}
}
mail($mailto, $subject, stripslashes($message), $header);
?><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Feedback</title>
<meta name="keywords" content="сельхозтехника, запчасти">
<meta name="author" content="Агротика">
<meta name="generator" content="WYSIWYG Web Builder 15 - http://www.wysiwygwebbuilder.com">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon">
<link href="css/Site_Agrotika2.css" rel="stylesheet">
<link href="css/feedback.css" rel="stylesheet">
<script src="jquery-1.12.4.min.js"></script>
<script src="wwb15.min.js"></script>
<script>
$(document).ready(function()
{
$('#wb_Text1').addClass('visibility-hidden');
function onScrollText1()
{
var $obj = $("#wb_Text1");
if (!$obj.hasClass("in-viewport") && $obj.inViewPort(true))
{
$obj.addClass("in-viewport");
AnimateCss('wb_Text1', 'transform-scale-in', 100, 2000);
}
else
if ($obj.hasClass("in-viewport") && !$obj.inViewPort(true))
{
$obj.removeClass("in-viewport");
AnimateCss('wb_Text1', 'animate-fade-out', 0, 0);
}
}
if (!$('#wb_Text1').inViewPort(true))
{
$('#wb_Text1').addClass("in-viewport");
}
onScrollText1();
$(window).scroll(function(event)
{
onScrollText1();
});
});
</script>
<meta name="yandex-verification" content="36fc8eb91d7a48a1" />
</head>
<body>
<div id="space"><br></div>
<div id="container">
</div>
<div id="wb_LayoutGrid1">
<div id="LayoutGrid1">
<div class="row">
<div class="col-1">
<div id="wb_Text1">
<span style="color:#FFFFFF;font-family:Arial;font-size:29px;">Ваше сообщение отправлено</span>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

Where is the mistake?
Thanks for any idea.
User avatar
Pablo
 
Posts: 23025
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Using PHP to collect Form data doesn't work

Post by Pablo »

First please note that this tutorial is for advanced users who want to implement their own script.
So, some knowledge of PHP is required.

If you are not an advanced user then it may be better to use the built-in script instead.
https://www.wysiwygwebbuilder.com/forms.html

If that still does not work then please read "Emails are not arriving in my inbox" in the FAQ:
http://www.wysiwygwebbuilder.com/forum/ ... 10&t=32967
tanik.sam
 
 
Posts: 16
Joined: Fri Jul 24, 2020 5:57 am

Re: Using PHP to collect Form data doesn't work

Post by tanik.sam »

Pablo wrote: Fri Jul 24, 2020 7:08 am First please note that this tutorial is...
Thank you for your quick unswer.
I'va made according to your recommendation (by using built-in PHP form processor), and there is success when I use the form on PC. But there is still no mail when I use android smartphone. Could you give me one more idea about this problem. Thank you in advance.
User avatar
Pablo
 
Posts: 23025
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Using PHP to collect Form data doesn't work

Post by Pablo »

Did you read the FAQ?
Did you contact your web host to ask why they do not send the email?
tanik.sam
 
 
Posts: 16
Joined: Fri Jul 24, 2020 5:57 am

Re: Using PHP to collect Form data doesn't work

Post by tanik.sam »

Yes,but I've not found information about difference between PC and smartphones. The problem just with one smartphone, I reseive the error-message, while on other devices (including other smartphones) it operates correctly. The error: "The specified email adress(tanik.sam@yandex.ru) is invalid." But it valid, of course, and i get mail from form on other devices.
Last edited by tanik.sam on Fri Jul 24, 2020 9:30 am, edited 1 time in total.
User avatar
Pablo
 
Posts: 23025
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Using PHP to collect Form data doesn't work

Post by Pablo »

What is the exact error?
What is the URL of the form?
tanik.sam
 
 
Posts: 16
Joined: Fri Jul 24, 2020 5:57 am

Re: Using PHP to collect Form data doesn't work

Post by tanik.sam »

I know the name of error because on error page in text there is an inscription ##error##
http://agrotika.by/about.html - it is a page where is a button ("envelope") in the left top of page. The form disscussed opens in lightbox.
User avatar
Pablo
 
Posts: 23025
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Using PHP to collect Form data doesn't work

Post by Pablo »

What is the error message?
tanik.sam
 
 
Posts: 16
Joined: Fri Jul 24, 2020 5:57 am

Re: Using PHP to collect Form data doesn't work

Post by tanik.sam »

The error message - the message which writen on page in case of error, including inscription ##error##. Namely- "The specified email adress(tanik.sam@yandex.ru) is invalid."
User avatar
Pablo
 
Posts: 23025
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Using PHP to collect Form data doesn't work

Post by Pablo »

It seems to work correct for me.
Did you enter a valid email address?
tanik.sam
 
 
Posts: 16
Joined: Fri Jul 24, 2020 5:57 am

Re: Using PHP to collect Form data doesn't work

Post by tanik.sam »

Thank you for your answers. As far as I've checked ( i've cheked pocofone p1,xiaomi mi a2 lite, lenovo a 5000, and samsung s9+, s10+ and PC), the problem is on samsung s9+ and samsung s10+.Have you faced similar situation?
User avatar
Pablo
 
Posts: 23025
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Using PHP to collect Form data doesn't work

Post by Pablo »

The emails are sent by the server, so the browser should not have any impact on whether or not the form works.

Maybe the browser blocks sending the email to the server address for privacy reasons?
tanik.sam
 
 
Posts: 16
Joined: Fri Jul 24, 2020 5:57 am

Re: Using PHP to collect Form data doesn't work

Post by tanik.sam »

Thank you for your advices very much! if i find the decision of problem with samsung smartphones, i'll write.
tanik.sam
 
 
Posts: 16
Joined: Fri Jul 24, 2020 5:57 am

Re: Using PHP to collect Form data doesn't work

Post by tanik.sam »

Hi! The problem with samsung dissapears when I imput e-mail in form manually. It doesn't depend on brouser (i tried three different brousers on samsung) Of course, it is uncomfortable for user. Did anybody face this problem? What was the decision?
User avatar
Pablo
 
Posts: 23025
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Using PHP to collect Form data doesn't work

Post by Pablo »

The problem with samsung dissapears when I imput e-mail in form manually.
What do you mean by this?

I have never heard about any issues with Samsung devices and email input.
WWB uses standard HTML elements. The software has no control over the behavior of input fields on browsers. It's standard HTML functionality.
tanik.sam
 
 
Posts: 16
Joined: Fri Jul 24, 2020 5:57 am

Re: Using PHP to collect Form data doesn't work

Post by tanik.sam »

I mean Samsung keyboard: if I type e-mail adress in form manually (without usage of ccookie-email-adress which appears as prompt in the top of keyboard) - all works perfectly. The same if I paste previously copied e-mail adress. But if I use prompt from cookie (wich appears in the top of keyboard when I start typing) - I have the mistake and my message is not send.
User avatar
Pablo
 
Posts: 23025
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Using PHP to collect Form data doesn't work

Post by Pablo »

This should not make a difference. But if it does then it's a bug in the browser.
tanik.sam
 
 
Posts: 16
Joined: Fri Jul 24, 2020 5:57 am

Re: Using PHP to collect Form data doesn't work

Post by tanik.sam »

Exactly it is not the bug of brauser, because i have the same situation when use chrome and mozilla. It is rather the bug of samsung keyboard.
Thank you for your answers.
Post Reply