Page 14 of 26 FirstFirst ... 4121314151624 ... LastLast
Results 131 to 140 of 259
  1. #131
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: custom forms - data collection

    Thanks!
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  2. #132
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: custom forms - data collection

    If anyone is using the "CAPTCHA using TTF & GD" mod and wanted to add that CAPTCHA mod to the forms created from this mod here's down and dirty what I did:

    In the form you created located in "includes/templates/YOUR_TEMPLATE/templates" find this:
    Code:
    </fieldset>
    
    <div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_SEND, BUTTON_SEND_ALT); ?></div>
    Paste the following just above this
    Code:
    <?php
    // BOF Captcha
    if(is_object($captcha) && (!$_SESSION['customer_id'])) {
    ?>
    <br class="clearBoth" />
    <?php echo $captcha->img(); ?>&nbsp;
    <?php echo $captcha->redraw_button(BUTTON_IMAGE_CAPTCHA_REDRAW, BUTTON_IMAGE_CAPTCHA_REDRAW_ALT); ?>
    <br class="clearBoth" />
    <label for="captcha"><?php echo TITLE_CAPTCHA; ?></label>
    <?php echo $captcha->input_field('captcha', 'id="captcha"') . '&nbsp;<span class="alert">' . TEXT_CAPTCHA . '</span>'; ?>
    <br class="clearBoth" />
    <?php
    }
    // BOF Captcha
    ?>
    In your header_php.php located in "includes/modules/pages/YOUR_FORM" find this:
    Code:
      require(DIR_WS_MODULES . 'require_languages.php');
      $breadcrumb->add(NAVBAR_TITLE);
    Just below this add:
    Code:
    // BOF Captcha
    if(CAPTCHA_CONTACT_US != 'false') {
        require(DIR_WS_CLASSES . 'captcha.php');
        $captcha = new captcha();
    }
    // EOF Captcha
    Then find this:
    Code:
       if ($error == false) {
    
    // grab some customer info if logged in
          if(isset($_SESSION['customer_id'])) {
    And just above it paste this:
    Code:
    // BOF Captcha Validation
      if (is_object($captcha) && !$captcha->validateCaptchaCode()) {
        $error = true;
        $messageStack->add('customer_questionnaire', ERROR_CAPTCHA);
      }
    // EOF Captcha Validation
    I think this covers everything I did.. (Hopefully I didn't overlook anything) So far my testing shows this works just perfectly..

    Here's the source I used: http://www.zen-cart.com/forum/showpo...&postcount=284

    This post shows how to add the CAPTCHA to the Returns Authorization form, but it was pretty to adapt the instructions here to work with this form.. Hopefully someone else will find it useful too..

  3. #133
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: custom forms - data collection

    Spoke too soon.. Gotta figure out why when I am logged in the CAPTCHA does not display.. Hmmm..

  4. #134
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: custom forms - data collection

    Got it!! I picked up the wrong code from another post in the CAPTCHA support thread..

    I've made the corrections to my original post.. (in bolded red)

    Quote Originally Posted by DivaVocals View Post
    If anyone is using the "CAPTCHA using TTF & GD" mod and wanted to add that CAPTCHA mod to the forms created from this mod here's down and dirty what I did:

    In the form you created located in "includes/templates/YOUR_TEMPLATE/templates" find this:
    Code:
    </fieldset>
    
    <div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_SEND, BUTTON_SEND_ALT); ?></div>
    Paste the following just above this
    Code:
    <?php
    // BOF Captcha
    if(is_object($captcha)) {
    ?>
    <br class="clearBoth" />
    <?php echo $captcha->img(); ?>&nbsp;
    <?php echo $captcha->redraw_button(BUTTON_IMAGE_CAPTCHA_REDRAW, BUTTON_IMAGE_CAPTCHA_REDRAW_ALT); ?>
    <br class="clearBoth" />
    <label for="captcha"><?php echo TITLE_CAPTCHA; ?></label>
    <?php echo $captcha->input_field('captcha', 'id="captcha"') . '&nbsp;<span class="alert">' . TEXT_CAPTCHA . '</span>'; ?>
    <br class="clearBoth" />
    <?php
    }
    // BOF Captcha
    ?>
    In your header_php.php located in "includes/modules/pages/YOUR_FORM" find this:
    Code:
      require(DIR_WS_MODULES . 'require_languages.php');
      $breadcrumb->add(NAVBAR_TITLE);
    Just below this add:
    Code:
    // BOF Captcha
    if(CAPTCHA_CONTACT_US != 'false') {
        require(DIR_WS_CLASSES . 'captcha.php');
        $captcha = new captcha();
    }
    // EOF Captcha
    Then find this:
    Code:
       if ($error == false) {
    
    // grab some customer info if logged in
          if(isset($_SESSION['customer_id'])) {
    And just above it paste this:
    Code:
    // BOF Captcha Validation
      if (is_object($captcha) && !$captcha->validateCaptchaCode()) {
        $error = true;
        $messageStack->add('your_form', ERROR_CAPTCHA);
      }
    // EOF Captcha Validation
    FYI, where I have the text "your_form", this means you should use the same name as the form you created.. In the original file from DrByte I think this was "band_signup"

    I think this covers everything I did.. (Hopefully I didn't overlook anything) So far my testing shows this works just perfectly..

    Here's the source I used: http://www.zen-cart.com/forum/showpo...&postcount=284

    This post shows how to add the CAPTCHA to the Returns Authorization form, but it was pretty to adapt the instructions here to work with this form.. Hopefully someone else will find it useful too..
    Last edited by DivaVocals; 22 Jun 2009 at 10:03 AM.

  5. #135
    Join Date
    Aug 2008
    Posts
    26
    Plugin Contributions
    0

    Default Re: custom forms - data collection

    Quote Originally Posted by DrByte View Post
    Thanks!
    Hi DrByte,

    I am looking for a module to conduct surveys, where the client meets a series of questions and answers can be analyzed in the admin area.

    Thanks

    Rolando Maldonado
    www.todoenguate.com

  6. #136
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: custom forms - data collection

    That would seem to be somewhat outside the scope of this discussion.

    You might try the addons area, and search for "survey" or "poll" for potential ideas.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #137
    Join Date
    Jan 2008
    Location
    Portland, Oregon USA
    Posts
    356
    Plugin Contributions
    0

    Default Re: custom forms - data collection

    Quote Originally Posted by rmaldonado View Post
    I am looking for a module to conduct surveys, where the client meets a series of questions and answers can be analyzed in the admin area.
    I ran across this when I was looking for an time slot calendar to put both on our ZenCart site and our blog.

    It's a form generator that you could conduct polls with. You'd probably have to correlate your own data.
    phpjabbers.com/contact-form/

    They have a poll scripts also.
    phpjabbers.com/php-poll/
    Doug

  8. #138
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: custom forms - data collection

    So I need a little clarification.

    I need to add a few radioboxes and some dropdowns. I have SCOURCED this forum for answers, and the closest I've come are these two threads:
    http://www.zen-cart.com/forum/showpo...2&postcount=12

    &

    http://www.zen-cart.com/forum/showpo...34&postcount=2

    The first link makes perfect sense to my non-coding brain, and would be easy for me to implement.

    I couldn't get the second one to work. (the dropdown showed fine, but it was not populated) Since I am no coder, I am sorta stumped in trying to troubleshoot why I couldn't get it to work.

    So here's my question. I was reading a post from DrByte (http://www.zen-cart.com/forum/showpo...93&postcount=2) that stated:
    Quote:
    Originally Posted by hyperspeed9
    I need make the list using Zen Carts method so that I can pass whatever a custom selects to be included in the email that is sent upon submission.


    Actually, you don't.

    All you need to do is check the value of the $_POST['merchant_desired'] variable, since that's what's set when someone chooses something from the SELECT ... OPTION .... OPTION ... OPTION ... /SELECT list you built in HTML.
    So if I understand this response correctly, I can add the following to my form:
    Code:
    <label class="inputLabelQuestions" for="question5">Have you had experience with premium hair?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
    <select name="question5" id="question5">
      <option value="[Select One]">[Select One]</option>
      <option value="Yes">Yes</option>
      <option value="No">No</option>
      <option value="Not sure what premium hair is">Not sure what premium hair is</option>
    </select>
    and as long as I configure my header_php.php file correctly, this should be okay.. Am I understanding this correctly??
    Code:
      if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
        $contact1_firstname = zen_db_prepare_input($_POST['contact1_firstname']);
        $contact1_lastname = zen_db_prepare_input($_POST['contact1_lastname']);
        $contact1_phone = zen_db_prepare_input($_POST['contact1_phone']);
        $contact1_email = zen_db_prepare_input($_POST['contact1_email']);
        $contact2_phone = zen_db_prepare_input($_POST['contact2_phone']);
        $question1 = zen_db_prepare_input($_POST['question1']);
        $question2 = zen_db_prepare_input($_POST['question2']);
        $question3 = zen_db_prepare_input($_POST['question3']);
        $question4 = zen_db_prepare_input($_POST['question4']);
        $question5 = zen_db_prepare_input($_POST['question5']);
        $question6 = zen_db_prepare_input($_POST['question6']);
        $question7 = zen_db_prepare_input($_POST['question7']);
        $question8 = zen_db_prepare_input($_POST['question8']);
        $code = zen_db_prepare_input($_POST['code']);
        $comments = zen_db_prepare_input(strip_tags($_POST['comments']));
    Last edited by DivaVocals; 27 Jun 2009 at 02:52 AM.

  9. #139
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: custom forms - data collection

    Based only on what you posted, yes, that appears reasonable.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  10. #140
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: custom forms - data collection

    Quote Originally Posted by DrByte View Post
    Based only on what you posted, yes, that appears reasonable.
    Coming from you that's good enough for me!! I was concerned that if I used HTML form code versus the Zen form functions (because I am not fully grasping how to create pulldowns and radioboxes using them..) that there would be issues with the forms.

    So here's what I came up with..

    My Form:
    Code:
    <?php
    //
    // +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce                                       |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2003 The zen-cart developers                           |
    // |                                                                      |
    // | http://www.zen-cart.com/index.php                                    |
    // |                                                                      |
    // | Portions Copyright (c) 2003 osCommerce                               |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license,       |
    // | that is bundled with this package in the file LICENSE, and is        |
    // | available through the world-wide-web at the following url:           |
    // | http://www.zen-cart.com/license/2_0.txt.                             |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to       |
    // | [email protected] so we can mail you a copy immediately.          |
    // +----------------------------------------------------------------------+
    // $Id: tpl_band_signup_default.php,v 1.3 2007/06/07 00:00:00 DrByteZen Exp $
    //
    ?>
    <div class="centerColumn" id="customerQuestionnaireDefault">
    
    <h1 id="customerQuestionnaireDefaultHeading"><?php echo HEADING_TITLE; ?></h1>
    
    <?php if ($messageStack->size('customer_questionnaire') > 0) echo $messageStack->output('customer_questionnaire'); ?>
    
    <?php
      if (isset($_GET['action']) && ($_GET['action'] == 'success')) {
    ?>
    <div class="mainContent success"><?php echo TEXT_SUCCESS; ?></div>
    
    <div class="buttonRow"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT) . '</a>'; ?></div>
    
    <?php
      } else {
    ?>
    <?php echo zen_draw_form('customer_questionnaire', zen_href_link(FILENAME_CUSTOMER_QUESTIONNAIRE, 'action=send', 'SSL')); ?>
    
    <div id="customerQuestionnaireContent" class="content">
    
    <p>This form can be used by first time customers and/or customers that aren't sure what to buy. Submit this form and some recommendations will be forwarded to you. This is a courtesy, [[Company Name Goes Here]] will not take any responsibilty if you do not like your purchase. Thanks again for choosing [[Company Name Goes Here]].</p>
    
    
    <fieldset id="customerQuestionnaire-Info">
    <legend> Contact Information </legend>
    <div class="alert forward"><?php echo FORM_REQUIRED_INFORMATION; ?></div>
    <br class="clearBoth" />
    
    <label class="inputLabel" for="contact1_firstname">First Name:</label>
    <?php echo zen_draw_input_field('contact1_firstname', zen_output_string_protected($contact1_firstname), ' size="30" id="contact1_firstname"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
    <br class="clearBoth" />
    
    <label class="inputLabel" for="contact1_lastname">Last Name:</label>
    <?php echo zen_draw_input_field('contact1_lastname', zen_output_string_protected($contact1_lastname), ' size="30" id="contact1_lastname"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
    <br class="clearBoth" />
    
    <label class="inputLabel" for="contact1_email">Email:</label>
    <?php echo zen_draw_input_field('contact1_email', zen_output_string_protected($contact1_email), ' size="30" id="contact1_email"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
    <br class="clearBoth" />
    
    <label class="inputLabel" for="contact1_phone">Phone:</label>
    <?php echo zen_draw_input_field('contact1_phone', zen_output_string_protected($contact1_phone), ' size="30" id="contact1_phone"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
    <br class="clearBoth" />
    
    <label class="inputLabel" for="contact2_phone">Cell Phone:</label>
    <?php echo zen_draw_input_field('contact2_phone', zen_output_string_protected($contact2_phone), ' size="30" id="contact2_phone"'); ?>
    </fieldset>
    <br class="clearBoth" />
    
    <fieldset id="customerQuestionnaire-Contacts">
    <legend> Please answer the following questions: </legend>
    <label class="inputLabelQuestions" for="question1">What do you want your hair to do?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
    <?php echo zen_draw_textarea_field('question1', 30, 4, zen_output_string_protected($question1), 'id="question1"'); ?>
    <br class="clearBoth" />
    
    <label class="inputLabelQuestions" for="question2">What state is your natural hair currently in?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
    <?php echo zen_draw_textarea_field('question2', 30, 4, zen_output_string_protected($question2), 'id="question2"'); ?>
    <br class="clearBoth" />
    
    <label class="inputLabelQuestions" for="question3">What styling options are you interested in?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
    <?php echo zen_draw_textarea_field('question3', 30, 4, zen_output_string_protected($question3), 'id="question3"'); ?>
    <br class="clearBoth" />
    <br />
    
    <label class="inputLabelQuestions" for="question4">Do you prefer virgin hair?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
    <select name="question4" id="question4">
      <option value="[Select One]">[Select One]</option>
      <option value="Yes - I prefer ONLY virgin hair">Yes - I prefer ONLY virgin hair</option>
      <option value="No - I do not like virgin hair">No - I do not like virgin hair</option>
      <option value="No preference - I like both virgin and premium processed hair">I like both virgin and premium processed hair</option>
      <option value="Never used virgin hair before">Never used virgin hair before</option>
    </select>
    <br class="clearBoth" />
    <br />
    
    <label class="inputLabelQuestions" for="question5">Have you had experience with premium hair?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
    <select name="question5" id="question5">
      <option value="[Select One]">[Select One]</option>
      <option value="Yes">Yes</option>
      <option value="No">No</option>
      <option value="Not sure what premium hair is">Not sure what premium hair is</option>
    </select>
    <br class="clearBoth" />
    <br />
    
    <label class="inputLabelQuestions" for="question6">What daily regime are you familiar with?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
    <?php echo zen_draw_textarea_field('question6', 30, 4, zen_output_string_protected($question6), 'id="question6"'); ?>
    <br class="clearBoth" />
    
    <label class="inputLabelQuestions" for="question7">What was your favorite hair style to date?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
    <?php echo zen_draw_textarea_field('question7', 30, 4, zen_output_string_protected($question7), 'id="question7"'); ?>
    <br class="clearBoth" />
    
    <label class="inputLabelQuestions" for="question8">What are your celebrity style inspirations?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
    <?php echo zen_draw_textarea_field('question8', 30, 4, zen_output_string_protected($question8), 'id="question8"'); ?>
    <br class="clearBoth" />
    
    <label class="inputLabel" for="comments">Other Remarks:</label>
    <?php echo zen_draw_textarea_field('comments', 30, 4, zen_output_string_protected($comments), 'id="comments"'); ?>
    <br class="clearBoth" />
    
    <?php
    // BOF Captcha
    if(is_object($captcha)) {
    ?>
    <?php echo $captcha->img(); ?>&nbsp;
    <?php echo $captcha->redraw_button(BUTTON_IMAGE_CAPTCHA_REDRAW, BUTTON_IMAGE_CAPTCHA_REDRAW_ALT); ?>
    <br class="clearBoth" />
    <label class="inputLabel" for="captcha"><?php echo TITLE_CAPTCHA; ?></label>
    <?php echo $captcha->input_field('captcha', 'id="captcha"') . '&nbsp;<span class="alert">' . TEXT_CAPTCHA . '</span>'; ?>
    <br class="clearBoth" />
    <?php
    }
    // BOF Captcha
    ?>
    
    </fieldset>
    
    <div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_SEND, BUTTON_SEND_ALT); ?></div>
    <div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT) . '</a>'; ?></div>
    
    <br class="clearBoth" />
    </div>
    </form>
    
    <?php
      }
    ?>
    </div>
    My Form Handler:
    Code:
    <?php
    //
    // +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce                                       |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2003 The zen-cart developers                           |
    // |                                                                      |
    // | http://www.zen-cart.com/index.php                                    |
    // |                                                                      |
    // | Portions Copyright (c) 2003 osCommerce                               |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license,       |
    // | that is bundled with this package in the file LICENSE, and is        |
    // | available through the world-wide-web at the following url:           |
    // | http://www.zen-cart.com/license/2_0.txt.                             |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to       |
    // | [email protected] so we can mail you a copy immediately.          |
    // +----------------------------------------------------------------------+
    // $Id: header_php.php,v 1.3 2007/06/07 00:00:00 DrByteZen Exp $
    //
      require(DIR_WS_MODULES . 'require_languages.php');
      $breadcrumb->add(NAVBAR_TITLE);
    
    // BOF Captcha
    if(CAPTCHA_CONTACT_US != 'false') {
        require(DIR_WS_CLASSES . 'captcha.php');
        $captcha = new captcha();
    }
    // EOF Captcha
    
      $error = false;
      $contact1_firstname = '';
      $contact1_lastname = '';
      $contact1_phone = '';
      $contact1_email = '';
      $contact2_phone = '';
      $question1 = '';
      $question2 = '';
      $question3 = '';
      $question4 = '';
      $question5 = '';
      $question6 = '';
      $question7 = '';
      $question8 = '';
      $comments = '';
      $code = '';
    
      if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
        $contact1_firstname = zen_db_prepare_input($_POST['contact1_firstname']);
        $contact1_lastname = zen_db_prepare_input($_POST['contact1_lastname']);
        $contact1_phone = zen_db_prepare_input($_POST['contact1_phone']);
        $contact1_email = zen_db_prepare_input($_POST['contact1_email']);
        $contact2_phone = zen_db_prepare_input($_POST['contact2_phone']);
        $question1 = zen_db_prepare_input($_POST['question1']);
        $question2 = zen_db_prepare_input($_POST['question2']);
        $question3 = zen_db_prepare_input($_POST['question3']);
        $question4 = zen_db_prepare_input($_POST['question4']);
        $question5 = zen_db_prepare_input($_POST['question5']);
        $question6 = zen_db_prepare_input($_POST['question6']);
        $question7 = zen_db_prepare_input($_POST['question7']);
        $question8 = zen_db_prepare_input($_POST['question8']);
        $code = zen_db_prepare_input($_POST['code']);
        $comments = zen_db_prepare_input(strip_tags($_POST['comments']));
    
    
    // BOF Error messages
        if (!zen_validate_email($contact1_email))  {
          $error = true;
          $messageStack->add('customer_questionnaire', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
          }
        if (!zen_not_null($contact1_firstname))  {
          $error = true;
          $messageStack->add('customer_questionnaire', 'Please fill in your First Name');
          }
        if (!zen_not_null($contact1_lastname))  {
          $error = true;
          $messageStack->add('customer_questionnaire', 'Please fill in your Last Name');
          }
        if (!zen_not_null($contact1_phone))  {
          $error = true;
          $messageStack->add('customer_questionnaire', 'Please fill in your phone number');
          }
        if (!zen_not_null($question1))  {
          $error = true;
          $messageStack->add('customer_questionnaire', '<strong>What do you want your hair to do?:</strong> In order for us to assist you, please provide us as much information as possible. If a question does not apply to you, please enter "Not applicable"');
          }
        if (!zen_not_null($question2))  {
          $error = true;
          $messageStack->add('customer_questionnaire', '<strong>What state is your natural hair currently in?:</strong> In order for us to assist you, please provide us as much information as possible. If a question does not apply to you, please enter "Not applicable"');
          }
        if (!zen_not_null($question3))  {
          $error = true;
          $messageStack->add('customer_questionnaire', '<strong>What styling options are you interested in?:</strong> In order for us to assist you, please provide us as much information as possible. If a question does not apply to you, please enter "Not applicable"');
          }
        if (!zen_not_null($question6))  {
          $error = true;
          $messageStack->add('customer_questionnaire', '<strong>What daily regime are you familiar with?:</strong> In order for us to assist you, please provide us as much information as possible. If a question does not apply to you, please enter "Not applicable"');
          }
        if (!zen_not_null($question7))  {
          $error = true;
          $messageStack->add('customer_questionnaire', '<strong>What was your favorite hair style to date?:</strong> In order for us to assist you, please provide us as much information as possible. If a question does not apply to you, please enter "Not applicable"');
          }
        if (!zen_not_null($question8))  {
          $error = true;
          $messageStack->add('customer_questionnaire', '<strong>What are your celebrity style inspirations?:</strong> In order for us to assist you, please provide us as much information as possible. If a question does not apply to you, please enter "Not applicable"');
          }
    /*
        if (!zen_not_null($code))  {
          $error = true;
          $messageStack->add('customer_questionnaire', 'Please enter validation code');
          }
        if (!zen_not_null($contact2_phone))  {
          $error = true;
          $messageStack->add('customer_questionnaire', 'Please fill in the contact2_phone');
          }
        if (!zen_not_null($question4))  {
          $error = true;
          $messageStack->add('customer_questionnaire', 'Please fill in the question4');
          }
        if (!zen_not_null($question5))  {
          $error = true;
          $messageStack->add('customer_questionnaire', 'Please fill in the question5');
          }
        if (!zen_not_null($comments))  {
          $error = true;
          $messageStack->add('customer_questionnaire', 'Please fill in the comments');
          }
    */
    // EOF Error messages
    
    //BOF Captcha
      if (is_object($captcha) && !$captcha->validateCaptchaCode()) {
        $error = true;
        $messageStack->add('customer_questionnaire', ERROR_CAPTCHA);
      }
     //EOF Captcha
    
       if ($error == false) {
    
    // grab some customer info if logged in
          if(isset($_SESSION['customer_id'])) {
            $check_customer = $db->Execute("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");
            $customer_email = $check_customer->fields['customers_email_address'];
            $customer_name = $check_customer->fields['customers_firstname'] . ' ' . $check_customer->fields['customers_lastname'];
          } else {
            $customer_email = 'Not logged in';
            $customer_name = 'Not logged in';
          }
    
    //assemble the email contents:
          $email_text = 'Customer Questionnaire' . "\n" .
            '------------------------------------------------------' . "\n" .
            'First Name:' . "\t" . $contact1_firstname . "\n" .
            'Last Name:' . "\t" . $contact1_lastname . "\n" .
            'Email:' . "\t" . $contact1_email . "\n" .
            'Phone:' . "\t" . $contact1_phone . "\n" .
            'Cell Phone:' . "\t" . $contact2_phone . "\n" .
            '------------------------------------------------------' . "\n" .
            'What do you want your hair to do?:' . "\n" . $question1 . "\n\n" .
            'What state is your natural hair currently in?:' . "\n" . $question2 . "\n\n" .
            'What styling options are you interested in?:' . "\n" . $question3 . "\n\n" .
            'Do you prefer virgin hair?:' . "\t" . $question4 . "\n\n" .
            'Have you had experience with Premium hair?:' . "\t" . $question5 . "\n\n" .
            'What daily regime are you familiar with?:' . "\n" . $question6 . "\n\n" .
            'What was your favorite hair style to date?:' . "\n" . $question7 . "\n\n" .
            'What are your celebrity style inspirations?:' . "\n" . $question8 . "\n\n" .
            'Other Remarks:' . "\n" . $comments . "\n\n" .
            '------------------------------------------------------' . "\n" .
            OFFICE_USE . "\t" . "\n" .
            OFFICE_LOGIN_NAME . "\t" . $customer_name . "\n" .
            OFFICE_LOGIN_EMAIL . "\t" . $customer_email . "\n" .
            OFFICE_IP_ADDRESS . "\t" . $_SERVER['REMOTE_ADDR'] . "\n" .
            OFFICE_HOST_ADDRESS . "\t" . gethostbyaddr($_SERVER['REMOTE_ADDR']) . "\n" .
            OFFICE_DATE_TIME . "\t" . date("D M j Y G:i:s T") . "\n" .
            '------------------------------------------------------' . "\n\n" .
          $email_text = zen_output_string_protected($email_text);
          $email_html = nl2br("\n" . $email_text);
    
    //send the email
          zen_mail(STORE_NAME, SEND_TO_ADDRESS, EMAIL_SUBJECT, $email_text, $contact1_firstname . ' ' . $contact1_lastname, $contact1_email, array('EMAIL_MESSAGE_HTML' => $email_html), 'customer_questionnaire');
    
          zen_redirect(zen_href_link(FILENAME_CUSTOMER_QUESTIONNAIRE, 'action=success'));
          } //endif $error=false
    
      } // endif action
    
    // default email and name if customer is logged in
      if(isset($_SESSION['customer_id'])) {
          $check_customer = $db->Execute("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . $_SESSION['customer_id'] . "'");
          if ($contact1_email == '') $contact1_email = $check_customer->fields['customers_email_address'];
          if ($contact1_firstname == '') $contact1_firstname = $check_customer->fields['customers_firstname'];
          if ($contact1_lastname == '') $contact1_lastname = $check_customer->fields['customers_lastname'];
      }
    
    ?>

 

 
Page 14 of 26 FirstFirst ... 4121314151624 ... LastLast

Similar Threads

  1. custom survey forms
    By cpk in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 2 May 2011, 05:07 PM
  2. Custom Forms
    By wwiii in forum General Questions
    Replies: 3
    Last Post: 11 May 2009, 05:51 PM
  3. Customer's seeing other users' data in forms
    By erikcw in forum General Questions
    Replies: 5
    Last Post: 30 Jan 2008, 11:30 PM
  4. Custom Collection of Attribute Data
    By Fastcar in forum General Questions
    Replies: 0
    Last Post: 15 Jan 2008, 01:01 PM
  5. Custom Forms - Help?
    By TurtleDove in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 9 Jun 2006, 02:46 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR