Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Thanks for the great script, but I am having issues...

  1. #1
    Join Date
    Mar 2004
    Posts
    2

    Question Thanks for the great script, but I am having issues...

    First off, the script was very easy to install and get to work, except for the csvfile which I keep getting an error that the file cannot be opened regardless of where I put it or the permissions I give it... might be an ISP issue...

    But the one that is really baffling me is that I am not getting all of the info from my form. I have multiple categories with multiple checkboxes in each. So far, I am ony getting one checkbox from each category even though multiple ones are checked... I've checked and double checked my form syntax and cannot find anything wrong.

    here's the form:

    http://www.baywestconstruction.com/contact/proposal.php

    TIA

    D

  2. #2
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Thanks for the great script, but I am having issues...

    Hi,

    That's a nice form!

    Checkboxes and radio buttons need to be handled differently and FormMail doesn't currently support them.

    Another user of FormMail sent us some code which he uses to handle these and we'll be adding this feature in the next couple of weeks.

    We'll also be adding support for HTML email, so you'll to get a nicely formatted form result in your email.

    Ted sent the following code to us, but we haven't checked it out in detail.

    The changes look simple, so you're welcome to try them:
    Making a form with multiple value elements (checkboxes and multiple select menus):
    PHP requires that you name such elements in your form in the following way, so that all selected values
    get passed as to PHP as an array:
    <input type="checkbox" name="events[]" value="Diving">Diving
    <input type="checkbox" name="events[]" value="Cycling">Cycling
    <select name="my_choices[]" multiple>
    <option value="Red">Red
    <option value="Blue">Blue
    </select>
    Note the [] at the end of each element name.
    PHP Code:
    The alteration to formmail.php is as follows:
    function 
    ParseInput($vars,&$a_values,$s_line_feed)
    {
        global  
    $SPECIAL_FIELDS,$SPECIAL_VALUES,$FORMATTED_INPUT;
        
    $output "";
            
    //
            // scan the array of values passed in (name-value pairs) and
            // produce slightly formatted (not HTML) textual output
            //
        
    while (list($name,$raw_value) = each($vars))
        {
            if (
    is_array($raw_value)) 
            {
                    
    //
                    // handle checkbox input
                    //
                
    while (list($checkbox_name,$checkbox_raw_value) = each($raw_value))
                {
                    if (
    is_string($checkbox_raw_value)) 
                    {
                            
    //
                            // truncate the string
                            //
                        
    $checkbox_raw_value substr($checkbox_raw_value,0,MAXSTRING);
                    }
                    
    $checkbox_value trim(Strip($checkbox_raw_value));
                    
    $a_values[$checkbox_name] = $checkbox_raw_value;
                    
    $output .= "$name$checkbox_name$checkbox_value".$s_line_feed;
                    
    array_push($FORMATTED_INPUT,"$name: '$value'");
                }
            }
            elseif (
    is_string($raw_value)) 
            {
                    
    //
                    // truncate the string
                    //
                
    $raw_value substr($raw_value,0,MAXSTRING);
            }
            
    $value trim(Strip($raw_value));
            if (
    in_array($name,$SPECIAL_FIELDS)) {
                
    $SPECIAL_VALUES[$name] = $value;
            }
            else
            {
                if (! 
    is_array($raw_value)) {
                    
    $a_values[$name] = $raw_value;
                    
    $output .= "$name$value".$s_line_feed;
                }
            }
            
    array_push($FORMATTED_INPUT,"$name: '$value'");
        }
        return (
    $output);

    It looks like you can just replace FormMail's ParseInput function with the above and it will all work.

    Good luck and please let us know if this works for you.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  3. #3
    Join Date
    Mar 2004
    Posts
    2

    Cool Re: Thanks for the great script, but I am having issues...

    Beauty!!!!

    It works like a charm!!!

    However, as you mentioned, it could do with some html formatting, but that's beside the point... I'm now getting all the data I need to get...

    Here's how it looks on my end in the email:

    To: xxxxx@baywestconstruction.com
    From: xxxxx@sonic.net ()

    --START--
    email: xxxxx@sonic.net
    realname:
    Purpose0: I'm not satisfied with my current contractor
    Project_Stage0: We Have Sketches
    Remodeling_Area0: Attic
    Remodeling_Area1: Bedroom
    Remodeling_Area2: Whole House
    Remodeling_Area3: this is other
    Project_Size0: 1500 - 2000 Sq. Ft.
    add_or_mod0: Cabinets
    add_or_mod1: Countertops
    add_or_mod2: Stairs
    Utilities_Affected0: Electrical
    Utilities_Affected1: Heat/Air/Ventilation
    Construction_Materials0: Wood
    Construction_Materials1: Undecided
    Construction_Materials2: other materials
    Total_Budget0: $30,000 - $50,000
    Project_Start0: 2 - 4 Months
    Details: these are details
    zip: 94952
    city: Petaluma
    fname: xxxxx
    lname: xxxxx
    areacode: XXX
    phone_number: XXX-XXXX
    best_call_time0: Weekend
    Submit: Submit Request

    ==================================

    REMOTE_HOST=
    REMOTE_ADDR=XXX.XXX.XXX.XXX
    HTTP_USER_AGENT=Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/124 (KHTML, like Gecko) Safari/125
    REMOTE_USER=


    Thanks,

    D

  4. #4
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Thanks for the great script, but I am having issues...

    That's great news!

    Your feedback will speed up our release of this into the production code.

    Thanks for letting us know.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  5. #5
    Join Date
    May 2004
    Posts
    3

    Default Re: Thanks for the great script, but I am having issues...

    Hello,

    I liked this post as I have much to do with formmail
    This is a great script and thanks for giving it for free.
    I have an issue too, Like I need the form results to get stored in csv format.
    So that all the submissions go and get stored in a single csv file.
    Apart from this I also wish to send an email with the csv attachment containing the form submission.
    -------------------------------
    I also want to use multiple check boxes like Darknightjedi di, his submission results are getting submitted like

    Construction_Materials0: Wood
    Construction_Materials1: Undecided
    Construction_Materials2: other materials

    where as I wish to see it as Construction_Materials: wood, undecided, other materials.

    In CSV I want to write as

    name, email, address, wood undecided othermaterials, phone.

    So the fields in my form would be
    name, email, address, Construction_materials(checkboxes), Phone.

    Is there any possibility to customize formmail like this. Even if I don't have to send email, I wish to submit data to CSV.

    Kindly help me in this regard. Appreciated.

    Coolguy.

  6. #6
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Thanks for the great script, but I am having issues...

    Hi,

    This is easy.

    In your form, just list the names of the related checkboxes with a "[]" appended:
    Code:
     
    <input type="checkbox" name="Construction_Materials[]" value="wood">Wood<br />
    <input type="checkbox" name="Construction_Materials[]" value="brick">Brick<br />
    <input type="checkbox" name="Construction_Materials[]" value="other">Other materials<br />
    Then just list in the "csvcolumns" hidden field the name "Construction_Materials".

    FormMail will list the checked values with a semicolon ";" separator in that CSV column. If you want a different separator set the $CSVINTSEP value in formmail.php.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  7. #7
    Join Date
    May 2004
    Posts
    3

    Thumbs up Re: Thanks for the great script, but I am having issues...

    Hello Russell,

    Thank you first.
    I followed your instructions.
    Now I am able to save the form to CSV. One more doubt I have, when I am only saving data to CSV file, I am not specifying any email recipient as I don't need, Is there a necessity for me to define:
    PHP Code:
    $TARGET_EMAIL = array(EMAIL_NAME."@domain\.com$"); 
    Lastly is there a possibility to send the form submission to an email ID in an attachment as CSV

    Thanks again for this excellent script.
    CoolGuy.

  8. #8
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Thanks for the great script, but I am having issues...

    If you're not sending email, just set it like this:

    PHP Code:
     $TARGET_EMAIL = array(); 
    Lastly is there a possibility to send the form submission to an email ID in an attachment as CSV
    You could create an HTML template which has no HTML in it; just a line that looks like this:

    Code:
    $firstname,$lastname,$email,$Date,$Time,$fieldX,$fieldY
    FormMail will create what it thinks is an HTML email and send it to you. The format is simply CSV.

    The HOW TO guide for sending HTML emails will give you all the instructions you need. Just leave out all the HTML tags in the template.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  9. #9
    Join Date
    May 2004
    Posts
    3

    Default Re: Thanks for the great script, but I am having issues...

    Thanks Russell for the information.

    I now have one more complication(not serious though ) is how to kill sessions files on windows like ...
    "sess_16a59302ff89245e1e235c5d9b684452"
    These files like the one are too many, everytime we use form one is getting created. How to delete them automatically? is there a means?

    Thanks,
    Coolguy.

  10. #10
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Thanks for the great script, but I am having issues...

    They should probably get cleaned up automatically by Apache or PHP.

    However, we can probably resolve the problem by a change to FormMail.

    I'll send you a new version to try.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Script Works, Email Contains No Information
    By JakeForest in forum FormMail Subscription Support
    Replies: 10
    Last Post: 28-Dec-2005, 10:51 PM
  2. Ok, love the script, but
    By andymike in forum FormMail Subscription Support
    Replies: 1
    Last Post: 25-Jul-2004, 03:58 AM
  3. FormMail Script Error Message
    By rose in forum FormMail Subscription Support
    Replies: 2
    Last Post: 27-Jun-2004, 04:59 AM
  4. DEF_ALERT setup in script - Don't understand
    By jodmcc in forum FormMail Subscription Support
    Replies: 2
    Last Post: 17-Jun-2004, 07:02 AM
  5. Great script but.....
    By Remosz in forum FormMail Subscription Support
    Replies: 3
    Last Post: 23-Mar-2004, 10:47 PM

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
  •