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

Dreamweaver Auto Responder when a user Submits a form

Explorer ,
Dec 29, 2016 Dec 29, 2016

Copy link to clipboard

Copied

Hi,

I am trying to add an auto responder to one of my existing forms I made in Dreamweaver.  If it has to be php, please give me detailed instructions on how to set up the form, and more importantly, how to set up a php file.  Also, where does that php file go? Where on the server?

Thanks so much!

Greg

Views

2.3K

Translate

Translate

Report

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

correct answers 1 Correct answer

LEGEND , Dec 30, 2016 Dec 30, 2016

You nearly had it - you need to construct the $email_body variable (see below)

<?php

if ($_POST){

$name = substr(strip_tags(html_entity_decode($_POST['name'])),0,50);

$company = substr(strip_tags(html_entity_decode($_POST['company'])),0,50);

$phone = substr(strip_tags(html_entity_decode($_POST['phone'])),0,15);

$subject = substr(strip_tags(html_entity_decode($_POST['subject'])),0,50);

$message = substr(strip_tags(html_entity_decode($_POST['message'])),0,200);

$email = filter_input(INPUT_POST, 'email', F

...

Votes

Translate

Translate
Community Expert ,
Dec 31, 2016 Dec 31, 2016

Copy link to clipboard

Copied

Have you tested your HTML5 forms in IE Compatibility Mode?

And then pretend you're a bot that has JS disabled?

That's why I use all 3.  If one fails, I have 2 other backups.  If the 2 client side methods fail, I have server-side backup which is 100% reliable.

Nancy

Nancy O'Shea— Product User, Community Expert & Moderator

Votes

Translate

Translate

Report

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
LEGEND ,
Dec 31, 2016 Dec 31, 2016

Copy link to clipboard

Copied

Nancy OShea wrote:

Have you tested your HTML5 forms in IE Compatibility Mode?

I thought 'required' was supported in IE 10x? However its not supported in any version of Safari so its useless at the moment as a front line solution.

And then pretend you're a bot that has JS disabled?

Bots (I'm told) will fill out all form fields - that's why I said it would still be critical to have some kind of spam server side solution.

Apart from bots I'm not really that worried about the small minority that have javascript switched off. You can still validate the input from the form fields using php but is there any real requirement to return an error message in those browsers that support the 'required' attribute as you can't leave fields blank or insert any information apart from an email address if that is the 'specific' requirement....so in simple forms would 'required' be enough rather than the necessity to include all this stuff:

if(empty($name) {

$error['name'] = "Please supply your name";

}

if(empty($message) {

$error['message'] = "Please supply your message";

}

if(isset($error['name'])) { echo $error['name']; }

etc etc etc

As I see it the 'required' field is doing that job in most modern browsers.

Votes

Translate

Translate

Report

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
Guru ,
Dec 31, 2016 Dec 31, 2016

Copy link to clipboard

Copied

If you don't use PHP validation/sanitization then your form is not secure. Getting past the HTML/jQuery/javascript checks is kindergarten level hacking.

But the HTML5 and jQuery checks don't make the user wait for PHP to do its thing.

Votes

Translate

Translate

Report

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
LEGEND ,
Dec 31, 2016 Dec 31, 2016

Copy link to clipboard

Copied

LATEST

Rob Hecker2 wrote:

If you don't use PHP validation/sanitization then your form is not secure. Getting past the HTML/jQuery/javascript checks is kindergarten level hacking.

But the HTML5 and jQuery checks don't make the user wait for PHP to do its thing.

Not really disputing the validation aspect of php l was just trying to work out if there would be a requirment to return an error input message given the required html5 attribute would cover some simple situations by flagging the error anyway.

Since Safari doesnt support the required attribute its not a useful solution at the moment anyway.

Votes

Translate

Translate

Report

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
LEGEND ,
Dec 30, 2016 Dec 30, 2016

Copy link to clipboard

Copied

Rob Hecker2 wrote:

Hey gang, are you seeing why I bowed out of this discussion at post 32? It's at post 44 and the OP is still asking questions. That's because this thread is a private tutorial in basic PHP.

Yup, I understand.

Votes

Translate

Translate

Report

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
Explorer ,
Dec 30, 2016 Dec 30, 2016

Copy link to clipboard

Copied

I'm sorry, but I don't understand something. For the message field, I changed it from a textbox to a text area. Now the form won't work, but I don't see where else in the code it needs to be changed. Can you help?

 

Votes

Translate

Translate

Report

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
Explorer ,
Dec 30, 2016 Dec 30, 2016

Copy link to clipboard

Copied

Nevermind, I got it to work.

Votes

Translate

Translate

Report

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
Explorer ,
Dec 30, 2016 Dec 30, 2016

Copy link to clipboard

Copied

Hey,

I've been tinkering around trying to forward the form to another page, when the user hits submit.  I tried putting in a forwarding page in the <form action='' method='post'> attribute.  Does it have to be a .php page, or could it be a .html page?  I tried it both ways, but either way, it does not send the email.  It does forward to the other page.

Or maybe, the form could be set so the form fields disappear when the user hits submit, and all they see is the message saying the form has been emailed.  I don't know if that is accomplished by the use of a forwarding page. 

Has anyone had any success?

Thanks

Votes

Translate

Translate

Report

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
LEGEND ,
Dec 30, 2016 Dec 30, 2016

Copy link to clipboard

Copied

webmaster698 wrote:

Or maybe, the form could be set so the form fields disappear when the user hits submit, and all they see is the message saying the form has been emailed. I don't know if that is accomplished by the use of a forwarding page.

<?php if(isset($message)) {

echo $message;

}

else { ?>

<form action='' method='post'>

<p>Email: <input name='email' type='email'  required/></p>

<p>Name: <input name='name' type='text'  required/></p>

<p>Company: <input name='company' type= 'text' required/></p>

<p>Phone: <input name='phone' type= 'text' required/></p>

<p>Subject: <input name='subject' type= 'text' required/></p>

<p>Message: <textarea name='message' required/></textarea></p>

<p><input name='submit' type='submit'/></p>

</form>

<?php } ?>

Votes

Translate

Translate

Report

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