Forum Replies Created

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • in reply to: Calculate Age from DOB #19914
    shorthills11
    Participant

    That works!
    Thank you!

    in reply to: Calculate Age from DOB #19850
    shorthills11
    Participant

    And to rule out a problem with my calculation code I added the $sample variable with some string data to the custom code section to see if I could get this data to appear on the emailed form.

     // Custom code section #1 - see documentation for examples
    			$sample = "this is sample data";
    			/* get year, month, day data from object */
                            .....
    

    and then I tried to push the data to the form:

    // Add the visitor IP to the email
    $config['extra']['IP address'] = Quform::getIPAddress();
    $config['extra']['Calculated Age'] = $calcAge;  // not showing up in the email
    $config['extra']['Sample Data'] = $sample;  // not showing up in the email
    

    Any help figuring this out would be greatly appreciated!
    Thanks!

    in reply to: Calculate Age from DOB #19849
    shorthills11
    Participant

    Ok so the form processes, butI can’t get the calculation to post in the email.
    What I did was
    a) I restored the original age section back to normal (though I pulled it off the .html end of the form)
    b) I added the calculation code to the “custom code section #1”
    c) I then used the advice at the URL below about how to add an item to the end of the form. I’m able to successfully show the field “Calculated Age” on the email. However, I can’t see the value of the $calcAge variable.

    Is this statement legal:

    $config['extra']['Calculated Age'] = $calcAge;
    
    in reply to: Calculate Age from DOB #19835
    shorthills11
    Participant

    So I did some more digging and I was able to get the form to process.
    I’m developing locally so I have to test via SMTP, but this runs:

    /* $age = new Quform_Element('age', 'Age'); */
    
    /* get year, month, day data from object */
    $year = $form->getValue('dob_year');
    $month = $form->getValue('dob_month');
    $day = $form->getValue('dob_day');
    
    /* create $dob time string */
    $dob = strtotime("$year-$month-$day");
    
    /* calculate age from $dob */
    $age = floor((time() - strtotime($dob)) / 31556926);
    $age .= "variable test"; /* adding "variable test" to $age to test that it's working. */
    
    $age = new Quform_Element('age'); // added this line 
    $form->addElement($age);
    

    Note I commented out the original $age declaration, and made a new one.

    in reply to: Fatal Error with Mail() #5331
    shorthills11
    Participant

    So I switched to SMTP and the form now processes, but I get no email. And the host verified all is fine on their end.

    The only thing I can think of is that I’m leaving the encryption parameter blank because they said there’s no encryption setting needed. If I leave

    /*’encryption’ => ” */

    blank or commented out, will that cause it not to send email?
    thanks!

    in reply to: Fatal Error with Mail() #5218
    shorthills11
    Participant

    THanks for your quick replies — I really appreciate it! I’m working with my host now…

    in reply to: Fatal Error with Mail() #5184
    shorthills11
    Participant

    Thanks for your reply. I changed process.php to “mail” and it was fine. But when I changed process2.php then it still throws the error. Process2.php is around 20 fields whereas process1.php is around 4. Could that be making the difference? the amount of data being passed?

    for whatever it’s worth if I turn off mail (e.g. make it false) then the script processes — so clearly it’s in the mail function.

    But my host says it’s the script because one works and one doesn’t.
    What’s the best way to proceed?
    Thanks.

Viewing 7 posts - 1 through 7 (of 7 total)
Be inspired. © 2025 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy