[SOLVED] Blank email being sent

notexa 02 Jul, 2007
I've created a custom template and configured Chrono Forms so that the template should be sent. But I recieve an email that only contains the ip-address of the sender.

Attached is a zipfile with all the settings:

- global_0x: global configuration
- result_0x: webpage, source from webpage, blank email
- afaan_0x: complete configuration of Chrono Forms

Any ideas on what I might be doing wrong ? [file name=chrono.zip size=122350]http://www.chronoengine.com/components/com_fireboard/uploaded/files/chrono.zip[/file]

Post edited by: notexa, at: 2007/07/02 05:51<br><br>Post edited by: notexa, at: 2007/07/02 15:16
GreyHead 02 Jul, 2007
Hi notexa,

Interesting - at first sight everything looks OK to me. I'll re-create your form later and see what is happening.

Do you get a 'correct' e-mail if you are unregistered?

Bob
GreyHead 02 Jul, 2007
Hi notexa,

Solved it. The problem is with the escaped double quotes in your html - these are perfectly good php but break ChronoForms parser when it looks for field names.

If you write name='vannaam' instead of name =\"vannaam\" it will work.

A couple of tips for writing 'echo' code in php (for double quoted strings like echo "my string").
[list]
  • Use single quotes for attributes then you don't need to escape them

  • You don't need to escape simple variables if they are marked out by spaces or other punctuation. So echo "Your name is $name"; works OK

  • You don't need to escape or concatenate new lines. That is you can continue quoted text from one line to the next without "."
  • [/list]Using these, you can simplify your code to
    <?php
    global $my;
    if ( $my->id ) {
    echo "Ik ben geregistreerd<br />
    Naam: $my->name<input type='hidden' name='vannaam' value='$my->name' /><br />
    Email: $my->email<input type='hidden' name='vanemail' value='$my->email' /><br />";
    } else {
    echo "Ik ben niet geregistreerd<br />
    Naam: <input type='text' name='vannaam' /><br />
    Email: <input type='text' name='vanemail' /><br />";
    }
    ?>
    <input type='submit' value='doorsturen'><?php
    global $my;
    if (!$my->id) {
    echo "Ik ben geregistreerd<br />
    Naam: $my->name<input type='hidden' name='vannaam' value='$my->name' /><br />
    Email: $my->email<input type='hidden' name='vanemail' value='$my->email' /><br />";
    } else {
    echo "Ik ben niet geregistreerd<br />
    Naam: <input type='text' name='vannaam' /><br />
    Email: <input type='text' name='vanemail' /><br />";
    }
    ?>
    <input type='submit' value='doorsturen'> 
    which is easier to read and to debug.

    Bob<br><br>Post edited by: GreyHead, at: 2007/07/02 10:50
    Max_admin 02 Jul, 2007
    Hi Notexa, Bob,

    Just a comment, the double quotes or single quotes are NOT an issue at all, botho f them should work fine, but at a: afaan_03.jpg I can see that your field name are like this : name="\something\" , the back slashes are the trouble!!

    Did you try to receive the email as "field names" ? the default option at the config ? if so then how did it look like ?

    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    GreyHead 02 Jul, 2007
    Hi Max,

    Just a comment, the double quotes or single quotes are NOT an issue at all,



    Not so, in this case the html is inside the <?php . . . ?> tags and so the double quotes have to be escaped by the slashes.

    For example:
    <?php echo "<input name=\"some_name\" name=\"$some_name\"/>"; ?>
    requires the slashes. The other way of writing it:
    <input name="some_name" value="<?php echo $some_name ?>" />
    doesn't require the slashes. But both are valid php.

    Bob
    Max_admin 02 Jul, 2007
    Right, sorry at my messages I didn't put my code into code tags so the backslashes gone and I didn't notice notexa is using PHP to echo everything too
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    GreyHead 02 Jul, 2007
    Hi Max,

    No problem - I did the same thing and it took me about 30 minutes to get all the quotes right and work out what was happening.

    Bob
    notexa 02 Jul, 2007
    Thanks a lot Bob ! Leaving out the backslash worked perfectly.
    And thanks for the tips on php :woohoo:
    This topic is locked and no more replies can be posted.