Форма отправляет на e-mail. Вот она:
http://help-windows.net/form.php и ниже.
Нужно подправить скрипт action_demo.php чтобы пользователь дополнительно переходил по внешней URL ссылке при каждой отправке.
Пришел к выводу что <form action> выполнять 2 действия одновременно не умеет.
PHP код:
<?php
//for the first use don't forget to specify your own encryption key for no spam control (file: "w2_acf/w2ContactForm.php")
require_once('w2ContactForm.php');
//a form is submited
if(isset($_POST) && !empty($_POST)){
//use the form hidden field form_id to know what form is submitted
$form_id = '';
if(isset($_POST['form_id']))
$form_id = $_POST['form_id'];
//creation of a new instance of Class Contact
$contact = new W2ContactForm();
//Specifies the emails sender. If you don't specifie email sender the email used to send the mail will be the user mail (who submit the form)
$contact->setMailSender('no-reply@mywebsite.net');
//Specifies the emails recipients. You can specifies several emails for multiple recipient. If only one email is specifie the default email will be the first (index 1)
$contact->setMailRecipient(array('1' => 'help.windows.net@gmail.com', '2' => 'help.windows.net@gmail.com'));
//Specifies if you want to use auto responder feature
$contact->setAutoResponder(true);
//Specifies if you want to use an email different that email sender to the auto responder
$contact->setMailResponder('no-reply2@mywebsite.net');
//internationnalization with simple .tmx file (laguages/w2_cf_notifications.tmx)
$contact->setLang('en');
//Use this code only if you need to send email via SMTP
//For SMTP sending - specify your own SMTP HOST (generally "smtp.domaine.com" - use "localhost" for Hosted Dedicated Server)
//Basic example
/*$contact->setSmtpHost('smtp.domaine.com');*/
//Example for gmail config (openSSL must be installed in your server to send mail via gmail smtp)
/*$config = array('ssl' => 'tls',
'port' => 587,
'auth' => 'login',
'username' => 'username@gmail.com',
'password' => 'password');
$contact->setSmtpHost('smtp.gmail.com', $config);*/
//I use a switch to specify the specific rules of PHP validation for each form. If you use several form in your website and you don't want to use a switch you can use several "action.php" file (action1.php, action2.php ... one file per form).
switch($form_id) {
//PHP rules of validation for form "example1-1"
case 'example1-1':
$contact->setMaxAttachmentFiles(5);
$contact->setRequiredFields(array('recipient', 'mail', 'subject', 'message', 'phone', 'datebirth', 'country', 'version', 'website'));
$contact->setBodyMessageFields('<p>E-mail: [mail]</p><p>Version: [version]</p><p>Phone: [phone]</p><p>Date of Birth: [datebirth]</p><p>Country: [country]</p><p>Web site: [website]</p><p>Message: [message]</p>');
break;
//PHP rules of validation for form "example1-2"
case 'example1-2':
$contact->setMaxAttachmentFiles(2);
$contact->setRequiredFields(array('recipient', 'mail', 'subject', 'message'));
break;
//PHP rules of validation for form "example1-3"
case 'example1-3':
$contact->setNoSpamControl(false);
$contact->setMaxAttachmentFiles(5);
break;
//PHP rules of validation for form "example1-4"
case 'example1-4':
$contact->setNoSpamControl(false);
$contact->setMaxAttachmentFiles(0);
break;
case 'example1-5':
//Specifies the max file size for the attachments files (in octet)
$contact->setMaxFileSize(1000000);
//IMPORTANT : Sepcifies the number of attachment file
$contact->setMaxAttachmentFiles(1);
//Specifies the accepted extensions (.jpg, .png, .pdf ...) for the attachments files
$contact->setExtFileOk(array('jpeg', 'jpg', 'png'));
//Specifies if you want to delete files uploaded after email sending
$contact->setDeleteUploadsAfterSending(true);
$contact->setRequiredFields(array('recipient', 'mail', 'subject', 'message'));
$contact->setBodyMessageFields('<p>E-mail: [mail]</p><p>Subject: [subject]</p><p>Message: [message]</p>');
break;
//PHP rules of validation for form "example-recaptcha"
case 'example-recaptcha':
$contact->setMaxAttachmentFiles(2);
$contact->setRequiredFields(array('recipient', 'mail', 'subject', 'message'));
$contact->setNoSpamControl(false);
$contact->setReCaptcha(true);
break;
//PHP rules of validation for form "example-ayah"
case 'example-ayah':
$contact->setMaxAttachmentFiles(5);
$contact->setRequiredFields(array('recipient', 'mail', 'subject', 'message'));
$contact->setNoSpamControl(false);
$contact->setAyah(true);
break;
default:
break;
}
//Sending email
$contact->sendEmail();
}
?>