Skip to main content
Tweeted twitter.com/#!/StackExpression/status/435815253218439168
Added some more relevant detail
Source Link

I'm fairly new to ExpressionEngine, and I hope the problem I'm running into is a simple one to solve. I'll try to illustrate it as best as possible:

I have a radio button field (created within a channel form) called favorite_food. It has 4 options, namely Pasta, Vegetables, Poultry, and Fruit. The form displays great, and submitted values are saved in the channel entries.

The problem comes in when I'm trying to display the results on another template, and specifically adding a conditional statement that checks if the user selected Fruit or not is causing me to go a little crazy. This is what I've tried:

{exp:channel:form channel="foods" entry_id="{segment_4}"}

    <!-- displays "Fruit" successfully -->
    <div>{favorite_food}</div> (displays Fruit on the screen)

    <!-- this does not display anything at all? -->
    {if favorite_food == "Fruit"}
        <div>You chose fruit!</div>
    {/if}

    <!-- even with PHP, this works great... -->
    <?php echo "{favorite_food}"; ?>

    <!-- ...but this also doesn't display anything at all? -->
    <?php
        if ("{favorite_food}" == "Fruit")
            echo "<div>You chose fruit!</div>";
    ?>

{/exp:channel:form}

I should mention that the PHP parsing is set to "input" on this template too. I hope I'm missing something really obvious here...thanks in advance for any assistance!

I'm fairly new to ExpressionEngine, and I hope the problem I'm running into is a simple one to solve. I'll try to illustrate it as best as possible:

I have a radio button field (created within a channel form) called favorite_food. It has 4 options, namely Pasta, Vegetables, Poultry, and Fruit. The form displays great, and submitted values are saved in the channel entries.

The problem comes in when I'm trying to display the results on another template, and specifically adding a conditional statement that checks if the user selected Fruit or not is causing me to go a little crazy. This is what I've tried:

{exp:channel:form channel="foods" entry_id="{segment_4}"}

    <!-- displays "Fruit" successfully -->
    <div>{favorite_food}</div> (displays Fruit on the screen)

    <!-- this does not display anything at all? -->
    {if favorite_food == "Fruit"}
        <div>You chose fruit!</div>
    {/if}

    <!-- even with PHP, this works great... -->
    <?php echo "{favorite_food}"; ?>

    <!-- ...but this also doesn't display anything at all? -->
    <?php
        if ("{favorite_food}" == "Fruit")
            echo "<div>You chose fruit!</div>";
    ?>

{/exp:channel:form}

I hope I'm missing something really obvious here...thanks in advance for any assistance!

I'm fairly new to ExpressionEngine, and I hope the problem I'm running into is a simple one to solve. I'll try to illustrate it as best as possible:

I have a radio button field (created within a channel form) called favorite_food. It has 4 options, namely Pasta, Vegetables, Poultry, and Fruit. The form displays great, and submitted values are saved in the channel entries.

The problem comes in when I'm trying to display the results on another template, and specifically adding a conditional statement that checks if the user selected Fruit or not is causing me to go a little crazy. This is what I've tried:

{exp:channel:form channel="foods" entry_id="{segment_4}"}

    <!-- displays "Fruit" successfully -->
    <div>{favorite_food}</div> (displays Fruit on the screen)

    <!-- this does not display anything at all? -->
    {if favorite_food == "Fruit"}
        <div>You chose fruit!</div>
    {/if}

    <!-- even with PHP, this works great... -->
    <?php echo "{favorite_food}"; ?>

    <!-- ...but this also doesn't display anything at all? -->
    <?php
        if ("{favorite_food}" == "Fruit")
            echo "<div>You chose fruit!</div>";
    ?>

{/exp:channel:form}

I should mention that the PHP parsing is set to "input" on this template too. I hope I'm missing something really obvious here...thanks in advance for any assistance!

Source Link

Simple conditional statement and parse order problem

I'm fairly new to ExpressionEngine, and I hope the problem I'm running into is a simple one to solve. I'll try to illustrate it as best as possible:

I have a radio button field (created within a channel form) called favorite_food. It has 4 options, namely Pasta, Vegetables, Poultry, and Fruit. The form displays great, and submitted values are saved in the channel entries.

The problem comes in when I'm trying to display the results on another template, and specifically adding a conditional statement that checks if the user selected Fruit or not is causing me to go a little crazy. This is what I've tried:

{exp:channel:form channel="foods" entry_id="{segment_4}"}

    <!-- displays "Fruit" successfully -->
    <div>{favorite_food}</div> (displays Fruit on the screen)

    <!-- this does not display anything at all? -->
    {if favorite_food == "Fruit"}
        <div>You chose fruit!</div>
    {/if}

    <!-- even with PHP, this works great... -->
    <?php echo "{favorite_food}"; ?>

    <!-- ...but this also doesn't display anything at all? -->
    <?php
        if ("{favorite_food}" == "Fruit")
            echo "<div>You chose fruit!</div>";
    ?>

{/exp:channel:form}

I hope I'm missing something really obvious here...thanks in advance for any assistance!