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.

Parsing php fails

January 25, 2011 12:42pm

Subscribe [4]
  • #1 / Jan 25, 2011 12:42pm

    Sjoerd

    233 posts

    I try to parse this:

    {exp:cookie_plus:set name="cnt_FirstName" value="<?php echo $_request['cnt_FirstName'] ?>" seconds="36000"}

    This is the result:
    See screenshot

    The PHP isn’t parsed. It is allowed in the template, parsing stage = output

    What is wrong?

  • #2 / Jan 25, 2011 2:39pm

    steph_rose

    17 posts

    PHP should have to be set to “input” as the parsing stage.

    Otherwise,  the {exp} tag would be parsed first, and because the php value would not be done yet, the {exp:cookie} tag would have no value for the value=”” parameter in the tag.

    So just switch the PHP to input on that template and it should work fine.

  • #3 / Jan 25, 2011 3:05pm

    Ingmar

    29245 posts

    Yes, definitely try PHP on Input, please. Let us know if that helps.

  • #4 / Jan 25, 2011 5:14pm

    Sjoerd

    233 posts

    The problem is when it is set to ‘input’, there is no action at all: the cookie is not set.

  • #5 / Jan 25, 2011 5:22pm

    steph_rose

    17 posts

    Do you have a get variable in the URL?

    like, ?cnt_FirstName= ?

    Or are you posting from a form?

  • #6 / Jan 25, 2011 5:31pm

    Sjoerd

    233 posts

    I am posting a form with Freeform, which method is ‘POST’. In the return page after submit the cookie has to be set with the value of the form field ‘cnt_FirstName’ from the form page.

  • #7 / Jan 25, 2011 5:46pm

    steph_rose

    17 posts

    From what I’m guessing, there’s a difference between the actual POSTing action, and the return page.

    So, the form posts, and then after all that is done, all that EE does is redirect you to a page. That redirected page does not get the POSTED variables to it as well. So you can’t use posted variables from that form.

    What would seem to be necessary would be a very simple extension on the email_send (or whatever it’s called now) hook that stories the username in a cookie so you can use it on any further pages that you want to by that user.

    On another note, if you’re trying to get posted variables, it’s much safer to use $_POST than $_REQUEST.

  • #8 / Jan 25, 2011 5:54pm

    Sjoerd

    233 posts

    Thanks for your help! Tomorrow I get some help from my programmer (I do only graphic design/HTML webdesign). I hope he will find a solution with some Javascript. I will post it here.

  • #9 / Jan 26, 2011 9:36am

    Sue Crocker

    26054 posts

    Thanks for the assist, steph_rose!
    Sounds good, Sjoerd. Let us know what you find out.

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

ExpressionEngine News!

#eecms, #events, #releases