trying to setup simple html page to send form content ... get errors

george2
57 Posts
george2 posted this 09 February 2020
Ask a Question

hi using
https://nicepage.com/doc/article/25066/how-to-create-a-simple-html-contact-form-in-nicepage-website-builder
code example 1 ... called file eml2.php

content of the file is

<?php $field_name $field_email $field_textarea $field_textarea-2 $field_textarea-1 specify the message recipient: $mail_to ; $mail_from ; $subject .$field_name; the email content: $body_message .$field_name."\n"; $body_message . .$field_email."\n"; $body_message . .$field_textarea."\n"; $body_message . .$field_textarea-2."\n"; $body_message . .$field_textarea-1; $headers .$mail_from."\r\n"; $headers . .$field_email."\r\n"; $mail_status $subject, $body_message, $headers); show a json message about the successful or unsuccessful sending a message if ($mail_status) { $resarray?> true);
header('Content-Type: application/json');
echo json_encode($resArray);
} else {
$resArray= array('success' => false);
header('Content-Type: application/json');
echo json_encode($resArray);
}

?>

the form can be found here http://order.adcard.xyz ...
I get errors when i submit... can you check my modified file please ... i cannot see ht is wrong an dont know where the php erros are logged...

thanks

george

hi using https://nicepage.com/doc/article/25066/how-to-create-a-simple-html-contact-form-in-nicepage-website-builder code example 1 ... called file eml2.php content of the file is &lt;?php $field_name $field_email $field_textarea $field_textarea-2 $field_textarea-1 specify the message recipient: $mail_to ; $mail_from ; $subject .$field_name; the email content: $body_message .$field_name.&quot;\n&quot;; $body_message . .$field_email.&quot;\n&quot;; $body_message . .$field_textarea.&quot;\n&quot;; $body_message . .$field_textarea-2.&quot;\n&quot;; $body_message . .$field_textarea-1; $headers .$mail_from.&quot;\r\n&quot;; $headers . .$field_email.&quot;\r\n&quot;; $mail_status $subject, $body_message, $headers); show a json message about the successful or unsuccessful sending a message if ($mail_status) { $resarray?&gt; true); header('Content-Type: application/json'); echo json_encode($resArray); } else { $resArray= array('success' => false); header('Content-Type: application/json'); echo json_encode($resArray); } ?> the form can be found here http://order.adcard.xyz ... I get errors when i submit... can you check my modified file please ... i cannot see ht is wrong an dont know where the php erros are logged... thanks george
Vote to pay developers attention to this features or issue.
6 Replies
Order By: Standard | Newest
magann
39 Posts
magann posted this 09 February 2020

You need to go back and try copying the code again. Your have text that was meant as comments only included in the code. For example you have "specify the message recipient:" with out the double slash // it should be //specify the message recipient if you want to keep it as comments. This isn't the only place you have uncommented text that was meant to be commented

//The email content:

  and  

//Show a json message about the successful or unsuccessful sending a message

You need to go back and try copying the code again. Your have text that was meant as comments only included in the code. For example you have "specify the message recipient:" with out the double slash // it should be //specify the message recipient if you want to keep it as comments. This isn't the only place you have uncommented text that was meant to be commented //The email content: and //Show a json message about the successful or unsuccessful sending a message
Support Team
Support Team posted this 10 February 2020

Hi George,

Try to copy the code from the tutorial once again and check that you do not miss anything. If that still does not work, please provide the copy of your script file and also the error that you get.

...................................................
Sincerely,
Hella
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hi George, Try to copy the code from the tutorial once again and check that you do not miss anything. If that still does not work, please provide the copy of your script file and also the error that you get. ................................................... Sincerely, Hella Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
george2
57 Posts
george2 posted this 10 February 2020
<?php

$field_name = $_POST['name'];
$field_email = $_POST['email'];
$field_textarea = $_POST['textarea'];
$field_textarea-2 = $_POST['textarea-2'];
$field_textarea-1 = $_POST['textarea-1'];

//Specify the message recipient:
$mail_to = 'george@geosz.com ';
$mail_from = 'EMAIL_USED_FOR_SENDING';
$subject = 'Message from a site visitor '.$field_name;

//The email content:
$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'About: '.$field_textarea."\n";
$body_message .= 'Photos: '.$field_textarea-2."\n";
$body_message .= 'Music: '.$field_textarea-1;
$headers = 'From: '.$mail_from."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);

//Show a json message about the successful or unsuccessful sending a message
if ($mail_status) {
$resArray= array('success' => true);
header('Content-Type: application/json');
echo json_encode($resArray);
} else {
$resArray= array('success' => false);
header('Content-Type: application/json');
echo json_encode($resArray);
}

?>

<?php $field_name = $_POST['name']; $field_email = $_POST['email']; $field_textarea = $_POST['textarea']; $field_textarea-2 = $_POST['textarea-2']; $field_textarea-1 = $_POST['textarea-1']; //Specify the message recipient: $mail_to = 'george@geosz.com '; $mail_from = 'EMAIL_USED_FOR_SENDING'; $subject = 'Message from a site visitor '.$field_name; //The email content: $body_message = 'From: '.$field_name."\n"; $body_message .= 'E-mail: '.$field_email."\n"; $body_message .= 'About: '.$field_textarea."\n"; $body_message .= 'Photos: '.$field_textarea-2."\n"; $body_message .= 'Music: '.$field_textarea-1; $headers = 'From: '.$mail_from."\r\n"; $headers .= 'Reply-To: '.$field_email."\r\n"; $mail_status = mail($mail_to, $subject, $body_message, $headers); //Show a json message about the successful or unsuccessful sending a message if ($mail_status) { $resArray= array('success' => true); header('Content-Type: application/json'); echo json_encode($resArray); } else { $resArray= array('success' => false); header('Content-Type: application/json'); echo json_encode($resArray); } ?>

Last edited 10 February 2020 by george2

george2
57 Posts
george2 posted this 10 February 2020

so see the script i am using above … it does contain the // for quoted text... i didnt realize to post here i had to format it!!!

anyway i have used the original correctly ALL I have done is added three textarea on my form and removed the message field i wasn't using … i did this in both the first section of the script and in the email contnt section...

the form when you hit the submit … see first post for the link to use...the submit runs the script flashes a message indicating an error and disappears and i dont kmow if the error is captured anywhere

any help would be welcome

thanks

george

so see the script i am using above … it does contain the // for quoted text... i didnt realize to post here i had to format it!!! anyway i have used the original correctly ALL I have done is added three textarea on my form and removed the message field i wasn't using … i did this in both the first section of the script and in the email contnt section... the form when you hit the submit … see first post for the link to use...the submit runs the script flashes a message indicating an error and disappears and i dont kmow if the error is captured anywhere any help would be welcome thanks george
magann
39 Posts
magann posted this 10 February 2020

maybe the dash - ($field_textarea-2 ) needs to be removed ($field_textarea2 ) I had my form working but when I put dash in it stopped working. I also ran your original code through a php check (https://phpcodechecker.com/) and it found errors. I got rid of the dash and it then checked as good. I hope that works.

https://www.w3schools.com/php/php_variables.asp

PHP Variables
A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume).

Rules for PHP variables:

A variable starts with the $ sign, followed by the name of the variable
A variable name must start with a letter or the underscore character
A variable name cannot start with a number
A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
Variable names are case-sensitive ($age and $AGE are two different variables)

maybe the dash - ($field_textarea-2 ) needs to be removed ($field_textarea2 ) I had my form working but when I put dash in it stopped working. I also ran your original code through a php check (https://phpcodechecker.com/) and it found errors. I got rid of the dash and it then checked as good. I hope that works. https://www.w3schools.com/php/php_variables.asp PHP Variables A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume). Rules for PHP variables: A variable starts with the $ sign, followed by the name of the variable A variable name must start with a letter or the underscore character A variable name cannot start with a number A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ) Variable names are case-sensitive ($age and $AGE are two different variables)
george2
57 Posts
george2 posted this 10 February 2020

you my friend are unbelievably brilliant....

thank you SO MUCH...

life is a wonderful learning process... its good to learn!!!

thank you thank you!!!

george

you my friend are unbelievably brilliant.... thank you SO MUCH... life is a wonderful learning process... its good to learn!!! thank you thank you!!! george
You must log in or register to leave comments