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
<?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
...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
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.
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.
Copy link to clipboard
Copied
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.
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.
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?
Copy link to clipboard
Copied
Nevermind, I got it to work.
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
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 } ?>