PDA

View Full Version : Another..Mail-to Form



machinist
12-27-2005, 04:10 PM
Hi Folks,

I am unable to get my contact/form page to work. When submit is hit, it just brings up the mail program set in my computer.

Reading this forum leads me to believe that my email being neither hosted (yet) by VodaHost, nor listed anywhere in c-panel may be the first issue I need to deal with. So… how /what, do I list where, if that is one of the issues.

Also, to anticipate the next problem, I am unsure what to put in the form property Encoding type. One source indicates it should be blank and another indicates it should be set to multipart/form-data.

TIA

navaldesign
12-27-2005, 05:01 PM
Hi Folks,

I am unable to get my contact/form page to work. When submit is hit, it just brings up the mail program set in my computer.

Reading this forum leads me to believe that my email being neither hosted (yet) by VodaHost, nor listed anywhere in c-panel may be the first issue I need to deal with. So… how /what, do I list where, if that is one of the issues.

Also, to anticipate the next problem, I am unsure what to put in the form property Encoding type. One source indicates it should be blank and another indicates it should be set to multipart/form-data.

TIA

Setup an email account from your control panel: Mail>Add Account.
Second: Use this email address in your form. At this point your form should work no matter whether you use a php processing script or not. However, for a more reliable solution you need a php processing script like the ones that have been presented in this forum. The general script is ok if you don't need validation of the fields, otherwise you need a more detailed script(depending also on the type of validation). Multipart or blankdepends on the kind of script.
If you wish upload the link to your formpage and i'll have a look. Maybe I can provide you with the wright script.

machinist
12-27-2005, 05:18 PM
Setup an email account from your control panel: Mail>Add Account.
Second: Use this email address in your form. At this point your form should work no matter whether you use a php processing script or not. However, for a more reliable solution you need a php processing script like the ones that have been presented in this forum. The general script is ok if you don't need validation of the fields, otherwise you need a more detailed script(depending also on the type of validation). Multipart or blankdepends on the kind of script.
If you wish upload the link to your formpage and i'll have a look. Maybe I can provide you with the wright script.
Thanks for the help, but I might have bigger issues for now. Not quite sure what to do next. My email has stopped working. I cannot check it, none of my passwords are working, etc. (The form issue has been partially solved—under the “action” property in the form, I had mailto: in there)

Note that I have done nothing in c-panel v-a-v email. I sort of thought I would/could keep the email where it was, for now. I checked the mail-hosting site, and they still list the former DNS info. (I only switched them to VodaHost a couple of hours ago.)

Does anyone know if the issues might wash out when Simplicato, the email host, catches up? I am paid up with Simplicato for a couple of years, although it is short money. Should I/Can I/Must I, switch the email stuff over to VodaHost?

navaldesign
12-27-2005, 05:29 PM
Thanks for the help, but I might have bigger issues for now. Not quite sure what to do next. My email has stopped working. I cannot check it, none of my passwords are working, etc. (The form issue has been partially solved—under the “action” property in the form, I had mailto: in there)

Note that I have done nothing in c-panel v-a-v email. I sort of thought I would/could keep the email where it was, for now. I checked the mail-hosting site, and they still list the former DNS info. (I only switched them to VodaHost a couple of hours ago.)

Does anyone know if the issues might wash out when Simplicato, the email host, catches up? I am paid up with Simplicato for a couple of years, although it is short money. Should I/Can I/Must I, switch the email stuff over to VodaHost?

If they are switching you to Voda, all of the features related to your domain will be disabled for the transition period. After the transfer, you will have to set up your email account again, on your Vodahost account. Obviously, you must use the same email address that you already had. It would be wise to create also another email account to use just for your form. By the way, are we co-patriots ? (GR)

machinist
12-27-2005, 06:44 PM
If they are switching you to Voda, all of the features related to your domain will be disabled for the transition period. After the transfer, you will have to set up your email account again, on your Vodahost account. Obviously, you must use the same email address that you already had. It would be wise to create also another email account to use just for your form. By the way, are we co-patriots ? (GR)
I found the mail setup, pop3, etc. stuff in c-panel and was able to figure it out, reset my server info in my mail program(s), etc. and I can now send and receive email like I could yesterday.

So now I go back to the mail form. It seems to be working right, as far as it goes, but I would like to set up a page that looks like my website, but with a “thank you, your information has been sent” in it. A quick read of forum posts indicates that I should read more and read slowly.

My old website is still available to me until 01/21, and maybe I can figure the code out from there.

Thanks, Patrioti

navaldesign
12-28-2005, 06:05 AM
I found the mail setup, pop3, etc. stuff in c-panel and was able to figure it out, reset my server info in my mail program(s), etc. and I can now send and receive email like I could yesterday.

So now I go back to the mail form. It seems to be working right, as far as it goes, but I would like to set up a page that looks like my website, but with a “thank you, your information has been sent” in it. A quick read of forum posts indicates that I should read more and read slowly.

My old website is still available to me until 01/21, and maybe I can figure the code out from there.

Thanks, Patrioti


It's been a pleasure.
From what I understand you are using the form just as it is provided in Bluevoda and you have set the action in mailto:
This way your form works but it is not sure it will work with all your visitors. It depends on the setup of your visitors mail client. Probably it will work for 95% of the cases. However, the php processing script is a more reliable solution.
It allows you to have validation of the fields (f.e. checks if your visitor's email is ????????@visitordomain.com type), it also allows you to define required fields, allows for personalised error pages depending on the type of error detected, allows reliable file upload - particularly useful for legal documents to be transferred to you directly from the form - , and also allows for a personalised Thankyou Page which you can built with the same style as the rest of your site. Last but not least, you can have a line or two of code that will provide you with your visitor's IP address, and information about his browser, as well as date and time of the submission.
When you get to that point I'll be glad to give you a hand if you need any tips.

Thanks

machinist
12-28-2005, 02:07 PM
It's been a pleasure.
From what I understand you are using the form just as it is provided in Bluevoda and you have set the action in mailto:
This way your form works but it is not sure it will work with all your visitors. It depends on the setup of your visitors mail client. Probably it will work for 95% of the cases. However, the php processing script is a more reliable solution.
It allows you to have validation of the fields (f.e. checks if your visitor's email is ????????@visitordomain.com type), it also allows you to define required fields, allows for personalised error pages depending on the type of error detected, allows reliable file upload - particularly useful for legal documents to be transferred to you directly from the form - , and also allows for a personalised Thankyou Page which you can built with the same style as the rest of your site. Last but not least, you can have a line or two of code that will provide you with your visitor's IP address, and information about his browser, as well as date and time of the submission.
When you get to that point I'll be glad to give you a hand if you need any tips.

Thanks
I will take you up on the offer.

As I posted somewhere else on the forum, I have my contact form working more or less as I want it to, but am unable to find scripting I can follow which would allow for required fields, legitimate email address, etc.

Any help is most appreciated.

navaldesign
12-28-2005, 06:08 PM
I will take you up on the offer.

As I posted somewhere else on the forum, I have my contact form working more or less as I want it to, but am unable to find scripting I can follow which would allow for required fields, legitimate email address, etc.

Any help is most appreciated.

Hi machinist,

upload the link to your form page. I'll examine it and provide you the necessary script. Please also let me know which fields have to be validated and what kind of validation you need for every field. Please note that we have a 7 hours difference so I just might have a look tommorow.

machinist
12-28-2005, 06:49 PM
Hi machinist,

upload the link to your form page. I'll examine it and provide you the necessary script. Please also let me know which fields have to be validated and what kind of validation you need for every field. Please note that we have a 7 hours difference so I just might have a look tommorow. http://xenoslaw.com/contact.html I guess telephone number, name, and email address should be required, and maybe a reminder if they are attempting to send without putting anything at all in the message section. How detailed you can get with regards to how “valid” the info is is another issue. As mentioned elsewhere, I am trying to guard against honest errors by those making legitimate inquiries, and I am trying to guard against “vandalism”, such as repeated hits of the submit button for no reason. Of course, suggestions, comments and/or recommendations on anything else I should be concerned with are, like all other assistance, greatly appreciated.

machinist
01-03-2006, 02:01 PM
Happy New Year to all,

I would like to try gain to write a contact/feedback form script containing some level of validation that at least checks that an approximately-valid email address has been placed in an email field, that something has been placed in a name field and that only numerals have been placed in a telephone number field(s). (I realize I will need to break my telephone number field into three separate fields, one for area-code and for each of the other three and four digit parts of the number.) Realizing that some folks may only want to put in either an email or a telephone number, and not both, I would like the validation to only require one or the other, not both.

Any takers?

Thanks.

navaldesign
01-03-2006, 03:44 PM
Hi machinist,

I have the script ready for you but I'm out of town. I will only be back by tommorow afternoon. However, in this script you can just define a field as required or not. It needs some further work to make it work with the alternative of either tel. or email required. As for the email validation, you can only check that the entered email is a ???@???.??? type, you can't realy validate the email itself. As for the malicious who would like to submit the form hundreds of times, the script has to be implemented with a "once only" piece of code, but this will prevent your visitors from using the form at regular times if they need to. So you'd better put a piece of code that detects the visitor's IP address and lets him know that it is monitored, so discouraging him from submitting many times. I'll upload the script for you tomorrow.
Have a nice year.

machinist
01-04-2006, 04:47 PM
I look forward to any help you can send my way.

navaldesign
01-06-2006, 10:41 AM
Hi machinist,


Copy the following code, and save it as your php page (http://www.xenoslaw.com/feedback.php).

Here's the code:


<?php

// Receiving variables from the form
@$Comments = addslashes($_POST['Comments']);
@$Name = addslashes($_POST['Name']);
@$Email = addslashes($_POST['Email']);
@$Company = addslashes($_POST['Company']);
@$Address = addslashes($_POST['Address']);
@$City = addslashes($_POST['City']);
@$Telephone = addslashes($_POST['Telephone']);
@$Fax = addslashes($_POST['Fax']);
// Validation
if (strlen($Comments) == 0 )
{
header("Location: error_comments.html");
exit;
}
if (strlen($Name) >40)
{
header("Location: error_name.html");
exit;
}
if (strlen($Name) == 0 )
{
header("Location: error_name.html");
exit;
}
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $Email))
{
header("Location: error_email.html");
exit;
}
if (strlen($Email) == 0 )
{
header("Location: error_email.html");
exit;
}
if (strlen($Telephone) == 0 )
{
header("Location: error_tel.html");
exit;
}
if (! ereg('[+0-9_-]+', $Telephone))
{
header("Location: error_tel1.html");
exit;
}

//Sending Form data to form owner
$pfw_header = "From: $Email\n"
. "Reply-To: $Email\n";
$pfw_subject = "Data Submitted from Webform";
$pfw_email_to = "youremail@yourdomain.com";
$pfw_message = "Comments: $Comments\n"
. "Name: $Name\n"
. "Email: $Email\n"
. "Company: $Company\n"
. "Address: $Address\n"
. "City: $City\n"
. "Telephone: $Telephone\n"
. "Fax: $Fax\n";
*****($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
header("Location: thankyou_page.html");
?>


Don't forget to change the youremail@yourdomain.com (youremail@yourdomain.com) with your real email on your Voda account.

The field lenght of 40 chrs for the name field can be changed to whatever you want.

2. Change the form page code, in the following line:

<form action="http://www.xenoslaw.com/feedback.php" method="POST" enctype="multipart/form-data">

I have already tried the form and it works fine.

Please feel free to test it at http://www.navaldesign.info/xenosform.html

As you can see the validation does the following:
1. Sets Name, Comments, email and Telephone fields as required.
2. Check the Email variable to see if it is a ????@???.??? type
3. Cheks if the Telephone variable is a numeric string.
4. For each kind or error, redirects to the relative Error Page.

Of course if you wish you can make just one Error page,but in that case your visitor will not know what he has done wrong.

At the end, after sending you the email, the script redirects your visitor to the Thankyou Page. From there you can redirect him automatically or manually to whatever page you want. Error pages and Thankyou Page can very easily be built with BlueVoda, and enriched with logo, pictures etc.I just used simple messages in this trial test.

Some of the error pages I have used for your test trial, are my own Error Pages.

Please note that when you try the form on my website, the emails will get to me.

Hope everything works out fine, if not I'm always here.

machinist
01-07-2006, 03:34 PM
NavalDesign

Thanks for the script. I have gotten it to work for me if the tested fields are valid, but am unable to test it out if not. My method to date is to have all tested fields be valid except for the name field. I have uploaded test files named: contact1.html, feedback1.php, and error_name.html.

(latest) Error reads:
Warning: Cannot modify header information - headers already sent by (output started at /home/ngxenos/public_html/feedback1.php:6) in /home/ngxenos/public_html/feedback1.php on line 98

Script in feedback1.php presently reads:

<?php

// Receiving variables from the form
@$Comments = addslashes($_POST['Comments']);
@$Name = addslashes($_POST['Name']);
@$Email = addslashes($_POST['Email']);
@$Company = addslashes($_POST['Company']);
@$Address = addslashes($_POST['Address']);
@$City = addslashes($_POST['City']);
@$Telephone = addslashes($_POST['Telephone']);
@$Fax = addslashes($_POST['Fax']);
// Validation
if (strlen($Comments) == 0 )
{
header("Location: error_comments.html");
exit;
}
if (strlen($Name) >40)
{
header("Location: error_name.html");
exit;
}
if (strlen($Name) == 0 )
{
header("Location: error_name.html");
exit;
}
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $Email))
{
header("Location: error_email.html");
exit;
}
if (strlen($Email) == 0 )
{
header("Location: error_email.html");
exit;
}
if (strlen($Telephone) == 0 )
{
header("Location: error_tel.html");
exit;
}
if (! ereg('[+0-9_-]+', $Telephone))
{
header("Location: error_tel1.html");
exit;
}

//Sending Form data to form owner
$pfw_header = "From: $Email\n"
. "Reply-To: $Email\n";
$pfw_subject = "Data Submitted from Webform";
$pfw_email_to = "youremail@yourdomain.com";
$pfw_message = "Comments: $Comments\n"
. "Name: $Name\n"
. "Email: $Email\n"
. "Company: $Company\n"
. "Address: $Address\n"
. "City: $City\n"
. "Telephone: $Telephone\n"
. "Fax: $Fax\n";
*****($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
header("Location: thankyou_page.html");
?>

Thanks again, and, as always, any suggestions are appreciated.

machinist
01-07-2006, 03:41 PM
Also, I just noticed that while the form appears to work when the fields are properly validated, the email that it sends to me does not contain the information that had been put into the fields, nor does it contain the form headings. It is blank.

Bernicat
01-07-2006, 07:09 PM
All dat stuff sound confusing!

navaldesign
01-07-2006, 07:19 PM
Also, I just noticed that while the form appears to work when the fields are properly validated, the email that it sends to me does not contain the information that had been put into the fields, nor does it contain the form headings. It is blank.

Can't really understand what is going wrong. It works perfectly for me, and I receive both the data and the headings. Also, you get an error message in line 98. My script only has 64 lines so I don't understand what you or me have done wrong. Please give me an email so i can attach the file for you. Use the form to let me know your email. Please also change the youreamail@yourdomain.com with your email on Vodahost.

I also understand that you have not uploaded the rest of the error pages: Ifyou don't that may cause the script to crash. You have to create and upload all the auxiliary pages that I described.

navaldesign
01-09-2006, 07:24 AM
Also, I just noticed that while the form appears to work when the fields are properly validated, the email that it sends to me does not contain the information that had been put into the fields, nor does it contain the form headings. It is blank.

As a brief summary to those interested: the problem of machinist is resolved through private messages. It was all due to the method of creation of the php page . Indeed, in machinist's case, the script provided should be directly uploaded to the server as "feedback.php" . It was though pasted in a html thankyoupage, as indicated in some other threads in this forum. The interaction between html and php caused the whole problem. This is not the appropriate approach to scripts intended to be used as stand alone. If you have a working script, don't modify it unless you're pretty sure of what you're doing, otherwise it might cost you many hours of work to figure out what is wrong. I know that this is not the approach provided in some other threads, where thankyou page and php script are on the same file, but mixing the visual part and the processing part sometimes may cause problems.