The following plugin code works fine for me locally running mamp and php 5.5.3, but returns nothing on our dev server running php 5.5.8:

$rating     = ee()->input->post('rating');
return $rating;

Both environments are running EE 2.7.3. The template code is as follows:

<form id="ratingform" action="/globals/process-save-and-rate/{last_segment}/10/" method="post">
    <input type="text" name="rating" id="rating" value="4">
    <input type="hidden" name="XID" value="{XID_HASH}">
    <button type="submit">Submit</button>

What is in 'process-save-and-rate' is as follows (and I know this should be a module to process the form):

{exp:switchee variable="{segment_4}" parse="inward"}
    {case value="1"}
        {exp:pp_general:save_property entry_id="{segment_3}" myaction="1"}
    {case value="2"}
        {exp:pp_general:save_property entry_id="{segment_3}" myaction="2"}
    {case value="3"}
        {exp:pp_general:save_property entry_id="{segment_3}" myaction="3"}
    {case value="10"}
        {exp:pp_general:save_and_rate entry_id="{segment_3}"}

If anyone can shed any light on why this is not working, I'd be very grateful. As I say, I'm just getting a blank screen whereas it should be outputting the value of the $rating variable.

Secure forms is turned on in EE. Turning it off and removing the XID hash gives the same result.

I'm not seeing any php errors so am a bit stumped.


  • what do you get when you var_dump($rating)? If it's not set it should return a boolean false. Mar 7 '14 at 13:35
  • Where $rating isn't set, the output I get is this: string(0) "". It isn't an array though. It should always be a single value. Mar 7 '14 at 14:12
  • sorry, meant var_dump(ee()->input->post()). Mar 7 '14 at 15:00
  • This is weird - I've getting "bool(false) " no matter what I enter in the form. That means that the post variables aren't being picked up by EE. Anyone know why this could be? Mar 7 '14 at 15:32
  • Just to rule out switchee misbehaving - could you try with 4 simple {if}{/if} statements instead of the switchee code? What happens then? Mar 7 '14 at 15:40

So this is now fixed. What I did was convert the plugin to a module and use EE's ACT action urls to handle the form posting.

I got some great tips from looking at Andrew Weaver's EE Addon Recipes site (http://ee-recipes.com) so thanks to Andrew for putting that out there.

  • don't forget authentication before processing POST-ed data.
    – GDmac
    Mar 17 '14 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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