Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
Locked
1

help with a very simple form script

Explorer ,
Oct 23, 2023 Oct 23, 2023

I just need a very simple script
send to : me@me.com
form field: name
form field : message

after success to: thankyou.html

no email address is entered (they are children)
the email that is received
it will look like this
letter from: (child's name)
he writes: (text message)

 

my formmail code:

<?php

//Create Variable Names
$name = trim($_POST['naam']);
$email = trim($_POST['email']);
$subject = StripSlashes($_POST['subject']);
$message = StripSlashes($_POST['bericht']);
   
//Clear variables
$name = "";
$email = "";
$subject = "";
$message = "";   
   
if(!empty($HTTP_POST_VARS['name']) || !empty($HTTP_POST_VARS['email'])){

$to = "vivke@telenet.be";   
$subject = "Sinterklaas";
$body .= "\n\n";
$body .= "This email is send by: " . $HTTP_POST_VARS['name'] . " \n\n<" . $HTTP_POST_VARS['email']  . ">\n\n";
$body .= "" . $HTTP_POST_VARS['message'] . "\n";
$body .= "\n";

$header = "From: " . $HTTP_POST_VARS['name'] . " <" . $HTTP_POST_VARS['email'] . ">\n";
$header .= "Reply-To: " . $HTTP_POST_VARS['name'] . " <" . $HTTP_POST_VARS['email'] . ">\n";
$header .= "X-Mailer: PHP/" . phpversion() . "\n";
$header .= "X-Priority: 1";

		if(mail($to, $subject, $body, $header)){
			echo "Sent";
			}
		else {
			echo "Error";
		}
} 	
else {
	echo "Error";
}
   


$to = ($HTTP_POST_VARS['email']);   
$subject = "website email";
$body = "Dear " . ($HTTP_POST_VARS['name']);
$body .= ",";
$body .= "\n\nThank you for your email. \n\nWe will surely read it, but because we receive so many mails, the answer\nsometimes may take a couple of days.\n\nToker \n";
$body .= "\n\n";
   
$header .= "X-Mailer: PHP/" . phpversion() . "\n";
$header .= "X-Priority: 1";
if(mail($to, $subject, $body, $header))
   
//redirect to the 'thank you' page
header('Location: danku.html');
?>

 I receive an eror, what do I wrong?

 

my formcode

<form action="formscript.php" method="post" name="form1" id="form1">
  <p>Jouw naam:
    <textarea name="naam" class="naambox" id="naam"></textarea>
  </p>
  <p>Jouw bericht aan Sinterklaas</p>
  <p>
    <textarea name="bericht" maxlength="500"  class="berichtbox" id="bericht"></textarea>
  </p>
  <p>&nbsp;</p>  <p>
    <input name="email" type="hidden" id="email" value="vivke@telenet.be">
  </p>
  <p> 

 

TOPICS
How to
128
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 23, 2023 Oct 23, 2023
LATEST

Already answered in yourother topic.

https://community.adobe.com/t5/dreamweaver-discussions/recaptcha-integration-in-a-html-page/td-p/141...

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines