Results 1 to 6 of 6
  1. #1
    Join Date
    May 2006
    Posts
    188
    Plugin Contributions
    0

    Default Forms- Comments Field

    Hi,

    Well, I'm almost done with my custom form for my website. I've ran a couple of tests, and they get sent correctly to the right email address. However, I do have a problem...

    When I type into the "Comments" field of the form, and click 'send', the email that I receieved contains all of the information that I filled out, EXCEPT for the information in the comments field.

    this is what is written in the tpl_birthday_club_default:

    <tr>
    <td class="plainBoxHeading" align="right" valign="top">Comments (optional):</td>
    <td class="main" valign="top"><?php echo zen_draw_textarea_field('comments', 'soft', 8, 4); ?></td>
    </tr>



    as for the header_php, this is what is written:

    $commments = zen_db_prepare_input($_POST['comments']);

    //assemble the email contents:
    'commments:' . "\t" . $commments . "\n" ;


    Am I missing something as "Comments" information is not being sent to me? (All other text fields are fine, except for this one)

  2. #2
    Join Date
    Jan 2004
    Posts
    60,536
    Blog Entries
    4
    Plugin Contributions
    145

    Default Re: Forms- Comments Field

    For security, I might add strip_tags, like this:
    PHP Code:
        $comments zen_db_prepare_input(strip_tags($_POST['comments'])); 
    ... but otherwise, I can't see anything wrong with what you've posted.

    How about posting the rest of the code, say 5-10 lines above and below this one:
    PHP Code:
    //assemble the email contents:
    'commments:' "\t" $commments "\n" 
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    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.



  3. #3
    Join Date
    May 2006
    Posts
    188
    Plugin Contributions
    0

    Default Re: Forms- Comments Field

    Doc,

    here is what I have down, around 10 below and above the line you asked for. Oh, and just wondering, would there be another code that I can use to replace this certain textfield code? Like input type="textarea" or such.

    Code:
    customers_lastname, customers_password, customers_email_address, 
    
    customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_id = '" . 
    
    $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_message_contents =
    'Email Address:' . "\t" . $contact1_email . "\n" .
    'First Name:' . "\t" . $contact1_firstname . "\n" .
    'Last Name:' . "\t" . $contact1_lastname . "\n" .
    'Mailing Address1:' . "\t" . $mailing_address1 . "\n" .
    'Mailing Address2:' . "\t" . $mailing_address2 . "\n" .
    'City:' . "\t" . $mailing_city . "\n" .
    'State:' . "\t" . $mailing_state . "\n" .
    'Zip Code:' . "\t" . $mailing_zipcode . "\n" .
    'Pet Name 1:' . "\t" . $pet_name1 . "\n" .
    'Pet Birthday 1:' . "\t" . $pet_birthday1 . "\n" ;
    'Pet Description 1:' . "\t" . $pet_description1 . "\n" ;
    'commments:' . "\t" . $commments . "\n" ;
    
    
    
    //send the email
    zen_mail(STORE_NAME, SEND_TO_ADDRESS, EMAIL_SUBJECT,
    OFFICE_FROM . "\t" . $name . "\n" .
    OFFICE_EMAIL . "\t" . $email_address . "\n\n" .
    '------------------------------------------------------' . "\n\n" .
    $email_message_contents ."\n\n" .
    '------------------------------------------------------' . "\n\n" .
    OFFICE_USE . "\t" . "\n" .
    OFFICE_LOGGIN_NAME . "\t" . $customer_name . "\n" .
    OFFICE_LOGGIN_EMAIL . "\t" . $customer_email . "\n" .
    OFFICE_IP_ADDRESS . "\t" . $_SERVER['REMOTE_ADDR'] . "\n" .
    OFFICE_HOST_ADDRESS . "\t" . gethostbyaddr($_SERVER['REMOTE_ADDR']) . "\n" .
    Last edited by DrByte; 11 Jun 2006 at 07:36 AM. Reason: put code in php block for easier reading

  4. #4
    Join Date
    Jan 2004
    Posts
    60,536
    Blog Entries
    4
    Plugin Contributions
    145

    Default Re: Forms- Comments Field

    PHP Code:
    //assemble the email contents:
    $email_message_contents =
    ..<
    snip removed for brevity>..
    'Zip Code:' "\t" $mailing_zipcode "\n" .
    'Pet Name 1:' "\t" $pet_name1 "\n" .
    'Pet Birthday 1:' "\t" $pet_birthday1 "\n" ;
    'Pet Description 1:' "\t" $pet_description1 "\n" ;
    'commments:' "\t" $commments "\n" 
    If you notice, the last 3 lines of this all end with a semi-colon... which closes the statement. You need to change those to periods (the first 2 of them) unless it's the last line of things to group together. If you notice, you likely aren't getting "Pet Description" content in your test emails either.

    Something like this would work better:
    PHP Code:
    //assemble the email contents:
    $email_message_contents =
    ..<
    snip removed for brevity>..
    'Zip Code:' "\t" $mailing_zipcode "\n" .
    'Pet Name 1:' "\t" $pet_name1 "\n" .
    'Pet Birthday 1:' "\t" $pet_birthday1 "\n" .
    'Pet Description 1:' "\t" $pet_description1 "\n" .
    'commments:' "\t" $commments "\n" 
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    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.



  5. #5
    Join Date
    May 2006
    Posts
    188
    Plugin Contributions
    0

    Default Re: Forms- Comments Field

    Yay! That worked perfectly. I've been so frustrated trying to figure it out myself (even thinking it was the way I named the tags), and I can't believe it was just a matter of taking off the colons.

    Another question though, what does the strip tag do? Specifically, how does it help in security?

    $comments = zen_db_prepare_input(strip_tags($_POST['comments']));

  6. #6
    Join Date
    Jan 2004
    Posts
    60,536
    Blog Entries
    4
    Plugin Contributions
    145

    Default Re: Forms- Comments Field

    strip_tags() is a function that removes any HTML tags that someone might enter in their message. This means they cannot embed any nasty stuff that could cause your server to go off and do unexpected things.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    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.



 

 

Similar Threads

  1. Update Data With SQLScripts Created In Excel
    By JuxiZoza in forum Setting Up Categories, Products, Attributes
    Replies: 74
    Last Post: 23 Mar 2006, 05:16 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
  •