Take the 2-minute tour ×
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

As noted, the form submits but the data doesn't go into the db. Looking at the rendered HTML, I notice a missing XID. I think this is what is causing the problem - anyone know why this would happen?

{exp:comment:form channel="articles" entry_id="{embed:entry_id}"}

    {if logged_out}
            <label for="name">Name:</label><input type="text" name="name" value="{name}" size="50" /><br />
            <label for="email">Email:</label> <input type="text" name="email" value="{email}" size="50" /><br />
    {/if}

    <label for="comment">Comment:</label>
    <textarea name="comment" cols="70" rows="10">{comment}</textarea>
    <label><input type="checkbox" name="save_info" value="yes" {save_info} /> Remember my personal information</label>
    <br />
    {if captcha}
            <label for="captcha">Please enter the word you see in the image below:</label><br />
            <p class="captcha">{captcha}<input type="text" name="captcha" value="{captcha_word}" maxlength="20" style="width: 200px; float: left;" /></p>
    {/if}
    <br />
    <input type="submit" name="submit" value="Submit" />

{/exp:comment:form}

Source:

<form id="comment_form" method="post" action="http://domain.com/newsroom_article/core-to-corporate">
        <div class="hiddenFields" style="display: none;">
        <input type="hidden" name="ACT" value="29">
        <input type="hidden" name="RET" value="http://domain.com/newsroom_article/core-to-corporate">
        <input type="hidden" name="URI" value="newsroom_article/core-to-corporate">
        <input type="hidden" name="PRV" value="">
        <input type="hidden" name="XID" value="">
        <input type="hidden" name="entry_id" value="3327">
        <input type="hidden" name="site_id" value="1">
        </div>
        <label for="name">Name:</label><input type="text" name="name" value="" size="50"><br>
        <label for="email">Email:</label> <input type="text" name="email" value="" size="50"><br>

        <label for="comment">Comment:</label>
        <textarea name="comment" cols="70" rows="10"></textarea>
        <label><input type="checkbox" name="save_info" value="yes"> Remember my personal information</label>
        <!--                                                    <label><input type="checkbox" name="notify_me" value="yes"  /> Notify me of follow-up comments?</label> -->
        <br>
        <label for="captcha">Please enter the word you see in the image below:</label><br>
        <p class="captcha"><img src="http://domain.com/images/captchas/1354086872.7556.jpg" width="140" height="30" style="border:0;" alt=" "><input type="text" name="captcha" value="" maxlength="20" style="width: 200px; float: left;"></p>
        <br>
        <input type="submit" name="submit" value="Submit">
        </form>
share|improve this question
    
Does your .htaccess have rules to add a trailing slash to URLs? I've had that bork form submissions in the past. –  Tyssen Nov 28 '12 at 7:46
    
Can you try testing the form outside the embed first and make sure it works? Is there a reason why you are embedding the comment form? Does the embed live outside the channel entries tag? –  John Henry Donovan Nov 28 '12 at 9:22
add comment

2 Answers

up vote 3 down vote accepted

Generally if form submissions aren't working, your .htaccess file is to blame.

Specifically, if you are using NSM htaccess generator, I've seen numerous problems with that, so avoid it. Also, if you are trying to force trailing slashes, stop now. EE 2.x really likes no trailing slash, and fighting it gets you nowhere.

The best solution is always to use the official htaccess, and nothing else:

RewriteEngine On

# Removes index.php from ExpressionEngine URLs
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
share|improve this answer
    
That did it- and I've had to do that before... not sure why it didn't register in my brain at midnight lol. –  Chad Crowell Nov 28 '12 at 16:40
    
I had the same problem, tried a lot, nothing worked but when I uninstalled NSM htaccess generator I could I could post comments –  awa May 22 '13 at 8:42
add comment

If secure forms is set to no in security settings, EE's forms don't use XID. Whilst this doesn't solve the problem of the data not saving, it should explain why there is no XID...

share|improve this answer
    
OK, it is set to No, so that explains that. I'll keep looking. Hope you are well Iain. –  Chad Crowell Nov 28 '12 at 7:30
    
Setting 'secure_forms' to 'y' in my config file returned the XID to the forms. –  yuvilio May 1 '13 at 17:55
add comment

protected by Community Mar 26 '13 at 15:08

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.