Форма <action> PHP
Форма отправляет на e-mail. Вот она: http://help-windows.net/form.php и ниже.
Нужно подправить скрипт action_demo.php чтобы пользователь дополнительно переходил по внешней URL ссылке при каждой отправке. Пришел к выводу что <form action> выполнять 2 действия одновременно не умеет. Цитата:
<script> jQuery(function($){ //Initialisation of the form $('#container_w2ContactForm').w2ContactForm({ noSpamControl: true, //Specifie if No Spam Control is activate (true / false) noSpamControlType: 3, //Spcifie the Type of No Spam Control (1 / 2) resetForm: true, //Spcifie if reset form after submit (true / false) attachmentFile: true, //Specifie if attachment file is activate (true / false) maxAttachments: 5, //Specifie the maximum number of attachments files showBtnSend: false, //Specifie if the btn send is visible when loading form when No Spam Control is activate (true / false) customFileInput: true, //Specifie if file input is custom skin (true / false) submitAlertType: "slide", //Specifie the type of alert displaying for submit (dialog / slide) maxAttAlertType: "slide", //Specifie the type of alert displaying for maximum attachments (dialog / slide) reCaptchaPublicKey: "null", //Specifie your reCaptcha PublicKey reCaptchaId: 'recaptcha_id', //Specifie an unqiue ID for HTML element where reCaptcha will be integrated (just specifie the ID do not create the element in the form) reCaptchaTheme: "clean", //Specifie the reCaptcha theme you want to use reCaptchaLang: "en", //Specifie the reCaptcha Lang you want to use reloadCaptcha: true, //Specifie if captcha is reloaded after submit (true / false) ayah: false //Specifie if AYAH is activate }); }); </script> <form class="w2_form cmxform" id="contactForm" method="post" enctype="multipart/form-data" action='w2_acf/action_demo.php'> <!--IMPORTANT DO NOT REMOVE--> <div class="timeField"></div> <input type="hidden" name="recipient" value="1" /> <div class="block_element_form" > <select id="country" name="version" class="required shadow"> <option value="" selected>Выберите услугу</option> <option value="nastroyka teamviewer">Удаленная (онлайн) компьютерная помощь</option> <option value="install Windows">Установка, настройка Windows</option> <option value="remont sborka">Ремонт, сборка компьютеров</option> <option value="Zaschita ot virusov">Удаление вирусов, защита от вирусов</option> <option value="Vosstanovlenie dannih">Восстановление данных</option> <option value="Ustanovka Wifi">Установка, настройка WiFi оборудования</option> </select> </div> <div class="block_element_form" > <select id="country" name="country" class="required shadow"> <option value="" selected>Выберите страну</option> <option value="ukraine">Украина</option> <option value="russia">Россия</option> <option value="byelorussia">Белоруссия</option> </select> </div> <div class="block_element_form"> <input id="adress" name="adress" class="shadow" minlength="2" type="text" value="Адрес проживания" onfocus="if (this.value == 'Адрес проживания') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Адрес проживания';}"/> </div> <div class="clear"> </div> <div class="block_element_form"> <input id="subject" name="subject" class="required shadow" minlength="2" type="text" value="Тема" onfocus="if (this.value == 'Тема') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Тема';}"/> </div> <div class="block_element_form"> <textarea id="message" name="message" class="required shadow" minlength="2" style="height:65px;" placeholder="Сообщение"></textarea> </div> <div class="clear"> </div> <!-- begin container for additionnals features (attachment file, no spam control) DO NOT REMOVE --> <div class="container_features" notification="(.jpg, .jpeg, .png, .gif, .pdf, .doc, .docx) не больше 5-ти файлов" ></div> <!-- end container for additionnals features --> <div class="block_element_form"> <button type="submit" class="btn_send shadow" style="display:none;"> Отправить <span></span> </button> <button type="reset" class="btn_send shadow" style="display:none;"> Очистить <span></span> </button> </div> </form> Цитата:
<?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);*/ 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(); } ?> |
форма и обработчик тут вообще ни при чем, т.к. у вас используется асинхронная обработка.
открываете js файл плагина, который используете для обработки формы (w2ContactForm.js), там ищете "submitAlertType" и меняете действие на window.location.replace("http://pryamo.i.nemnogo.napravo"); |
Спасибо, я решил по другому:
<button type="submit" class="btn_send shadow nt" rel="nofollow" onclick="window.open('http://')">Оплатить</button></div> отправляется форма и открывается в отдельном окне ссылка |
В php обрабатываешь форму и делаешь редирект через header('Location: http://newlink.com') (вроде так)
|
Часовой пояс GMT +3, время: 01:38. |