忽略PHP帖子中的字段

I am sending email using php. I am looping through all fields of form and using it in html template.

But, I need to ignore one field named captcha.

Original working code:

<body>
    <h2>Form Submission Data</h2>
    <table border="0" cellpadding="0" cellspacing="0" >
    {% for name,value in post %}
        <tr>
            <td class="colname">{{ name }}</td>
            <td>{{ value }}</td>
        </tr>
    {% endfor %}
    </table>

</body>

My modified (non working) code:

  <body>
    <h2>Form Submission Data</h2>
    <table border="0" cellpadding="0" cellspacing="0" >
        {% for name,value in post %}
        if({{ name }} != 'captcha')
        {
            <tr>
                <td class="colname">{{ name }}</td>
                <td>{{ value }}</td>
            </tr>
        }
    {% endfor %}
    </table>

</body>

if({{ name }} != 'captcha') doesnt work

Looks to me that you are missing some % in your code (are you sure it compiles?)

Try this?

{% for name,value in post 
      if( name  != 'captcha')
      {
      %}
        <tr>
            <td class="colname">{{ name }}</td>
            <td>{{ value }}</td>
        </tr>
    {% }
     endfor %}