ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Problem With PHP Mail Form

December 15, 2010 12:14pm

Subscribe [2]
  • #1 / Dec 15, 2010 12:14pm

    Dale-

    63 posts

    I’m new to EE 2.x, but have built a few sites with EE 1.x. I have a site that works great as a stand-alone install (sans EE), but my PHP mail form chokes with EE 2.1. I’ve used the included EE email module in the past (EE 1.x), but would prefer to use my current code on this one if possible, so I’m hoping it’s something simple. Otherwise, I’ll go with the EE mail option and figure out how to get what I need from it.

    My form has a textarea with fsendmail used as the message handler variable. The error I’m getting is:

    A PHP Error was encountered
    Severity: Notice
    Message:  Undefined variable: fsendmail
    Filename: libraries/Functions.php(640) : eval()‘d code
    Line Number: 116

    Is there a simple solution or minor hack to fix this? Can we define the variable in Functions.php? I use this script on several sites and prefer the message style and the way validation alerts are handled, etc. Barring its use I suppose I can go to js for the alerts, but prefer to avoid it if possible.

    Thank you.

  • #2 / Dec 15, 2010 6:41pm

    Lisa Wess

    20502 posts

    Hi, Dale -

    That error indicates a problem in your PHP parsing, in the visited template at line number 116.

    My recommendation would be one of these:

    1. Use the built-in contact form.
    2. Use Solspace’s FreeForm module
    3. Turn your code into an EE module for use

    I hope that helps!

  • #3 / Dec 15, 2010 7:50pm

    Dale-

    63 posts

    Hi Lisa,

    Thank you for your reply.

    The line (116) is a very simple textarea with an echo of “fsendmail” if present. Maybe I’m missing something simple in the line, but since it works outside EE I’ve not had to troubleshoot it.

    <textarea id="message" class="contact_fld"  name="fsendmail" cols="" rows="8"  <?php if($fsendmail) {echo @$fsendmail;} ?> > </textarea>

    In the mean time I’ll look at the other options you’ve suggested (Solspace, etc.). I guess I can just place the file outside of EE as well as it need not be managed through the control panel. Of course I was hoping to find a solution to the specific error so that I could use what fills my other needs, and keep things tidily inside of EE. 😊

  • #4 / Dec 15, 2010 10:05pm

    Dale-

    63 posts

    After re-evaluating Solspace’s FreeForm I’ve decided that it’s overkill for the task. I’ve re-coded for use with the built-in form for now, but will consider building a simple module at a later date. I prefer that the field input validation alerts occur on the same page as the form and haven’t figured out if or how it can be done with the built-in email form. AJAX is an option, or I can look into altering the alerts in the existing EE form code. Trying to keep javascript to a minimum, so will continue to poke around this.

    Thank you Lisa.

  • #5 / Dec 16, 2010 8:27am

    Sue Crocker

    26054 posts

    Glad Lisa was able to help. Don’t hesitate to post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases