Sorry I didn't answer for so long, I was on vacation.
You are correct, this is a caching problem and it can be resolved with turning off the cache. But this is not a pretty solution, since the cache is part of what makes stacey so great.
One solution would be to prevent stacey from caching any page, that includes a PHP script; or you could mark pages that should not be cached with a file in it (".nocache") or something like that. Not really pretty either.
Then I thought "Why not use AJAX to circumvent the cache?", so here's my solution.
This example application performs a, presumably easy, task: You enter a name in a field, click 'submit' and the page displays a greeting. That could be done by jQuery alone but we want to parse in through a PHP script first.
I created a folder called "php" in the stacey root folder, so this is "/php/application.php":
echo "Hello, " . $_POST['field'] . "!";
For this to work I had to move the template's jQuery include to the <head> of the html, I don't know why I had to, but it wouldn't work otherwise. The template calls the :html partial so we can have some basic html and JS.
This is "/content/1.myPageName/application.html":
<label for="field">Name: </label>
<input type="text" id="field" name="field" value="" />
<input type="submit" id="submit" name="submit" /><br /><br />
As you can see, the jQuery JS overrides the default behaviour of the submit button, reads the value of the input field and passes this as a POST-parameter to the AJAX request now performed on the .php.
The .php now parses the value of "field" any way we want (in this case "Hello, <name>!") and echoes it; this is the AJAX response that is now loaded into the response-<div> ... This circumvents the caching and produces good results without a page reload.
You could use this technique to POST data to any kind of script you like, as well as display anything a PHP script echoes.
When I find the time, I might write a simple contact form using this.