New Zenner
- Join Date:
- Apr 2008
- Posts:
- 39
- Plugin Contributions:
- 0
custom forms - data collection
Well it is your code so I am sure you are correct I will tinker with it a bit more.
Mel
Views: 221,970
New Zenner
Well it is your code so I am sure you are correct I will tinker with it a bit more.
Mel
New Zenner
thanks for this great addon! I am using the "become_dist_v1.03.zip" version.
I was wondering if there would be a way to add a "upload picture" feature and have the photo emailed as an attachment with the rest of the email.
I'm trying to hack my way through this but haven't been succesful. (not a php expert)
I've tried looking at these
http://www.html-form-guide.com/email-form/php-email-form-attachment.html
http://www.zymic.com/tutorials/php/creating-a-file-upload-form-with-php
and tried to come up with a frankenstein. no luck. any suggestions?
New Zenner
I need some help with fixing the formatting of this form:
http://greenleafexhibits.com/index.php?main_page=contact_us
I added the phone number contrib, and it seems to have worked fine, but it's formatting is messed up. Can someone tell me why it doesnt line up with the other entrys? I'd also like for it to be the same length. Once I get this resolved, I feel pretty confident I can add other fields, by duplicating the new phone entry lines in the files and changing the names.
Thanks!
New Zenner
Nevermind. I found it in stylesheet_tm.css.... there was a 4px margin defined for the text area.
New Zenner
header_php.php question(s)
I'm trying to incorporate a three page form into my zen cart store and the problems I have are how to include include files and javascript.
I'm pretty sure the .js should go into the
includes/modules/pages/myformpage/jscript/myjs.js
for includes I've tried to put them on this page:
includes/modules/pages/myformpage/header_php.php
as
include('path_to_my/include.php');
also tried a variation with the file in the 'modules' directory and use this: ```
require(DIR_WS_MODULES . 'include.php');
either way my custom page comes up blank
same thing happens when I try to unset session variables in the header_php.php file or the tpl_myformpage_default.php file:
unset($_SESSION['myformvar']);
can someone point me in the right direction? Where do I put these things?
Totally Zenned
What a gem of a find!!! Got this working perfectly..
I do have one question.. A little earlier in this thread there was a bit of discussion on making this for work with SSL.. The posted solution is not very clear.. Can anyone confirm if this for will work with SSL and/or how to make the band solution work with SSL.
I'm wondering if accessing a form created using Dr Bytes solution via an EZ Page link (with SSL enabled) would be enough to do the trick??
Sensei
To have the form process with SSL, you'd need to alter the zen_href_link parameters (I think it's the 3rd parameter that would need to be set to 'SSL') inside the zen_draw_form function call so that when the form's action parameter is produced it will contain the SSL URL instead. This will make the form be processed over SSL, regardless whether the URL in the browser is HTTPS or not.
If you want the browser URL to contain HTTPS, then whatever links you have pointing to the page will have to be manually coded to be in HTTPS.
Totally Zenned
DrByte:
To have the form process with SSL, you'd need to alter the zen_href_link parameters (I think it's the 3rd parameter that would need to be set to 'SSL') inside the zen_draw_form function call so that when the form's action parameter is produced it will contain the SSL URL instead. This will make the form be processed over SSL, regardless whether the URL in the browser is HTTPS or not.
If you want the browser URL to contain HTTPS, then whatever links you have pointing to the page will have to be manually coded to be in HTTPS.
Thanks for the response. Hope you don't mind me imposing on your expertise for one more thing?? Could I ask you to grade my homework here??
Is this the correct way to make this change?
<?php echo zen_draw_form('customer_questionnaire', zen_href_link(FILENAME_CUSTOMER_QUESTIONNAIRE, 'action=send'[B], 'SSL'[/B])); ?>
Sensei
Without going and actually studying the code, yes, that looks like it's probably correct.
Totally Zenned
DrByte:
Without going and actually studying the code, yes, that looks like it's probably correct.That's good enough for me!:smile: Just wanted to make sure that the syntax looked correct.. (I looked at the login form for a little guidance after reading you hint)
Thanks again for the responses, and the awesome contribution!!! I hope the Zen Cart team enjoys the coffee I sent..:smile:
Sensei
Thanks!
Totally Zenned
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:
</fieldset>
<div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_SEND, BUTTON_SEND_ALT); ?></div>
```Paste the following just above this
<?php
// BOF Captcha
if(is_object($captcha) && (!$_SESSION['customer_id'])) {
?>
<br class="clearBoth" />
<?php echo $captcha->img(); ?>
<?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"') . ' <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:
```
require(DIR_WS_MODULES . 'require_languages.php');
$breadcrumb->add(NAVBAR_TITLE);
```Just below this add:
```
// BOF Captcha
if(CAPTCHA_CONTACT_US != 'false') {
require(DIR_WS_CLASSES . 'captcha.php');
$captcha = new captcha();
}
// EOF Captcha
```Then find this:
```
if ($error == false) {
// grab some customer info if logged in
if(isset($_SESSION['customer_id'])) {
// 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/showpost.php?p=501585&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..
Totally Zenned
Spoke too soon.. Gotta figure out why when I am logged in the CAPTCHA does not display.. Hmmm..
Totally Zenned
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)
</fieldset> <div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_SEND, BUTTON_SEND_ALT); ?></div> ```Paste the following just above this > ``` <?php // BOF Captcha [B]if(is_object($captcha)) {[/B] ?> <br class="clearBoth" /> <?php echo $captcha->img(); ?> <?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"') . ' <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: > ``` require(DIR_WS_MODULES . 'require_languages.php'); $breadcrumb->add(NAVBAR_TITLE); ```Just below this add: > ``` // BOF Captcha if(CAPTCHA_CONTACT_US != 'false') { require(DIR_WS_CLASSES . 'captcha.php'); $captcha = new captcha(); } // EOF Captcha ```Then find this: > ``` if ($error == false) {DivaVocals:
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:
// grab some customer info if logged in
if(isset($_SESSION['customer_id'])) {
> ```
// BOF Captcha Validation
if (is_object($captcha) && !$captcha->validateCaptchaCode()) {
$error = true;
$messageStack->add('[B]your_form[/B]', 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/showpost.php?p=501585&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..
New Zenner
DrByte:
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
https://www.todoenguate.com
Sensei
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 Follower
rmaldonado:
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/
Totally Zenned
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/showpost.php?p=355112&postcount=12
&
http://www.zen-cart.com/forum/showpost.php?p=212034&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/showpost.php?p=585593&postcount=2) that stated:
Quote:
Originally Posted by hyperspeed9 [IMG]http://www.zen-cart.com/forum/images/zc_gray/buttons/viewpost.gif[/IMG]
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:
<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??
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']);
[B]$question5 = zen_db_prepare_input($_POST['question5']);[/B]
$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']));
Sensei
Based only on what you posted, yes, that appears reasonable.
Totally Zenned
DrByte:
Based only on what you posted, yes, that appears reasonable.Coming from you that's good enough for me!! :smile: 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:
<?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(); ?>
<?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"') . ' <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:**
<?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'];
}
?>
Tell staff why this post should be reviewed.