# MAR - manage\_result

**URL:** <https://discourse.softpress.com/t/mar-manage-result/5197>\
**Category:** Dynamo\
**Created:** [July 3, 2009, 1:59am UTC](https://discourse.softpress.com/t/mar-manage-result/5197 "2009-07-03T01:59:27Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Account](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/a/8baadc/32.png) [@Account](https://discourse.softpress.com/u/Account)\
**Post date:** [July 3, 2009, 1:59am UTC](https://discourse.softpress.com/t/mar-manage-result/5197/1 "2009-07-03T01:59:27Z")

</div>

On the front-end of my MAR demo when the form is sent it redirects to  
a separate “thanks” page but instead of this I want to include a brief  
inline [flash] message.

So, below is part of the controller that I modified to do this:

controller (partial code): [http://pastie.org/532787](http://pastie.org/532787)

along with a screenshot of the result after submitting the form which  
as you can see shows the inline message

screenshot: [http://www.anoptic.com/images/mar.tiff](http://www.anoptic.com/images/mar.tiff)

but also a few errors that I’ve been unable to fix in the model file:

model (partial code): [http://pastie.org/532792](http://pastie.org/532792)

Todd

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![Account](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/a/8baadc/32.png) [@Account](https://discourse.softpress.com/u/Account)\
**Post date:** [July 3, 2009, 2:09am UTC](https://discourse.softpress.com/t/mar-manage-result/5197/2 "2009-07-03T02:09:14Z")

</div>

The correct url for the screenshot is \<[http://www.anoptic.com/MAR/images/mar.tiff](http://www.anoptic.com/MAR/images/mar.tiff)

> . Sorry.

Todd

On Jul 2, 2009, at 8:59 PM, Todd wrote:

> On the front-end of my MAR demo when the form is sent it redirects  
> to a separate “thanks” page but instead of this I want to include a  
> brief inline [flash] message.
> 
> So, below is part of the controller that I modified to do this:
> 
> controller (partial code): [http://pastie.org/532787](http://pastie.org/532787)
> 
> along with a screenshot of the result after submitting the form  
> which as you can see shows the inline message
> 
> screenshot: [http://www.anoptic.com/images/mar.tiff](http://www.anoptic.com/images/mar.tiff)
> 
> but also a few errors that I’ve been unable to fix in the model file:
> 
> model (partial code): [http://pastie.org/532792](http://pastie.org/532792)

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![waltd](https://discourse.softpress.com/user_avatar/discourse.softpress.com/waltd/32/2720_2.png) [@waltd](https://discourse.softpress.com/u/waltd)\
**Post date:** [July 3, 2009, 3:17am UTC](https://discourse.softpress.com/t/mar-manage-result/5197/3 "2009-07-03T03:17:20Z")

</div>

manage\_result() needs a fourth parameter passed to it – the address of the success page – and you’re only passing it three parameters.

You could get the effect you’re after here by redirecting the page to itself, and using the regular session-based flash.

Walter

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![Account](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/a/8baadc/32.png) [@Account](https://discourse.softpress.com/u/Account)\
**Post date:** [July 3, 2009, 3:21am UTC](https://discourse.softpress.com/t/mar-manage-result/5197/4 "2009-07-03T03:21:15Z")

</div>

That’s what I’m trying to do (I think) and to an extent I did; I get  
the message I want to appear above the form (see screenshot) but I  
still don’t know how to fix the errors (screenshot).

T.

On Jul 2, 2009, at 10:17 PM, waltd wrote:

> You could get the effect you’re after here by redirecting the page  
> to itself, and using the regular session-based flash.

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![waltd](https://discourse.softpress.com/user_avatar/discourse.softpress.com/waltd/32/2720_2.png) [@waltd](https://discourse.softpress.com/u/waltd)\
**Post date:** [July 3, 2009, 4:30am UTC](https://discourse.softpress.com/t/mar-manage-result/5197/5 "2009-07-03T04:30:31Z")

</div>

The errors are happening because you’re leaving off the link to the current page as the fourth parameter to the function. Try this:

[http://pastie.org/532867](http://pastie.org/532867)

Walter

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![Account](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/a/8baadc/32.png) [@Account](https://discourse.softpress.com/u/Account)\
**Post date:** [July 3, 2009, 5:05am UTC](https://discourse.softpress.com/t/mar-manage-result/5197/6 "2009-07-03T05:05:23Z")

</div>

I tried it with $self earlier tonight and all I get is a parse error:

Parse error: syntax error, unexpected T\_VARIABLE, expecting T\_CASE or  
T\_DEFAULT or ‘}’ in/Applications/MAMP/htdocs/MAR/client/controllers/  
mar\_controller.php on line 3

On Jul 2, 2009, at 11:30 PM, waltd wrote:

> The errors are happening because you’re leaving off the link to the  
> current page as the fourth parameter to the function. Try this:
> 
> [http://pastie.org/532867](http://pastie.org/532867)

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![waltd](https://discourse.softpress.com/user_avatar/discourse.softpress.com/waltd/32/2720_2.png) [@waltd](https://discourse.softpress.com/u/waltd)\
**Post date:** [July 3, 2009, 11:32am UTC](https://discourse.softpress.com/t/mar-manage-result/5197/7 "2009-07-03T11:32:19Z")

</div>

That $self = part has be outside of the switch statement. Only case  
elements are allowed inside the switch. Try moving that line up to the  
top of the script – get it above the line that begins with

```
switch ($verb){

```

Walter

On Jul 3, 2009, at 1:05 AM, Todd wrote:

> I tried it with $self earlier tonight and all I get is a parse error:
> 
> Parse error: syntax error, unexpected T\_VARIABLE, expecting T\_CASE  
> or T\_DEFAULT or ‘}’ in/Applications/MAMP/htdocs/MAR/client/  
> controllers/mar\_controller.php on line 3
> 
> On Jul 2, 2009, at 11:30 PM, waltd wrote:
> 
> > The errors are happening because you’re leaving off the link to the  
> > current page as the fourth parameter to the function. Try this:
> > 
> > [http://pastie.org/532867](http://pastie.org/532867)
> 
> * * *
> 
> dynamo mailing list  
> email@hidden  
> Update your subscriptions at:  
> [http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![Account](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/a/8baadc/32.png) [@Account](https://discourse.softpress.com/u/Account)\
**Post date:** [July 3, 2009, 2:09pm UTC](https://discourse.softpress.com/t/mar-manage-result/5197/8 "2009-07-03T14:09:53Z")

</div>

OK, that solves part of the problem; I thought I did put it above the  
switch but in fact I mistakingly put it between the switch and case.

The form submits to the database fine but the page doesn’t redirect  
back to itself and there’s an error stating that it can’t connect to  
the server (I’m doing this locally) even though my local server is  
clearly running.

T.

On Jul 3, 2009, at 6:32 AM, Walter Lee Davis wrote:

> That $self = part has be outside of the switch statement. Only case  
> elements are allowed inside the switch. Try moving that line up to  
> the top of the script – get it above the line that begins with
> 
> switch ($verb){

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![waltd](https://discourse.softpress.com/user_avatar/discourse.softpress.com/waltd/32/2720_2.png) [@waltd](https://discourse.softpress.com/u/waltd)\
**Post date:** [July 3, 2009, 3:26pm UTC](https://discourse.softpress.com/t/mar-manage-result/5197/9 "2009-07-03T15:26:08Z")

</div>

What happens if you copy the URL out of the browser’s location window, paste it in a new window, and press return?

> The form submits to the database fine but the page doesn’t redirect back to itself and there’s an error stating that it can’t connect to the server (I’m doing this locally) even though my local server is clearly running.

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![Account](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/a/8baadc/32.png) [@Account](https://discourse.softpress.com/u/Account)\
**Post date:** [July 3, 2009, 3:33pm UTC](https://discourse.softpress.com/t/mar-manage-result/5197/10 "2009-07-03T15:33:12Z")

</div>

The same thing happens.

I just noticed what must be the problem. I’m running MAMP and my local  
url is [http://localhost:8888/MAR/client/](http://localhost:8888/MAR/client/). But when the page tries to  
redirect back to itself the url shows as:  
[http://localhost/MAR/client/mar](http://localhost/MAR/client/mar).

That’s got to be it, no? Question is, how do fix it.

Todd

On Jul 3, 2009, at 10:26 AM, waltd wrote:

> What happens if you copy the URL out of the browser’s location  
> window, paste it in a new window, and press return?
> 
> > The form submits to the database fine but the page doesn’t redirect  
> > back to itself and there’s an error stating that it can’t connect  
> > to the server (I’m doing this locally) even though my local server  
> > is clearly running.

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![waltd](https://discourse.softpress.com/user_avatar/discourse.softpress.com/waltd/32/2720_2.png) [@waltd](https://discourse.softpress.com/u/waltd)\
**Post date:** [July 3, 2009, 3:48pm UTC](https://discourse.softpress.com/t/mar-manage-result/5197/11 "2009-07-03T15:48:14Z")

</div>

Easy. Just be more thorough about creating $self.

```auto
$self = 'http://' . $_SERVER['SERVER_NAME'];
$self .= ($_SERVER['SERVER_PORT'] != '80') ? ':' .  
$_SERVER['SERVER_PORT'] : '';
$self .= $_SERVER['REQUEST_URI'];

```

That should fix things for you. Naturally, on a real Apache running by  
default in port 80, none of these shenanigans are required.

Walter

On Jul 3, 2009, at 11:33 AM, Todd wrote:

> The same thing happens.
> 
> I just noticed what must be the problem. I’m running MAMP and my  
> local url is [http://localhost:8888/MAR/client/](http://localhost:8888/MAR/client/). But when the page  
> tries to redirect back to itself the url shows as:  
> [http://localhost/MAR/client/mar](http://localhost/MAR/client/mar).

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![Account](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/a/8baadc/32.png) [@Account](https://discourse.softpress.com/u/Account)\
**Post date:** [July 3, 2009, 4:00pm UTC](https://discourse.softpress.com/t/mar-manage-result/5197/12 "2009-07-03T16:00:29Z")

</div>

That fixed the redirect error but the flash message doesn’t appear  
now, the page reloads with no indication of the form being sent (which  
it is). I quickly tried it on the live server without all the hoop-  
jumping below and the result is the same, no errors but no message  
either.

T.

On Jul 3, 2009, at 10:48 AM, Walter Lee Davis wrote:

> Easy. Just be more thorough about creating $self.
> 
> ```auto
> $self = 'http://' . $_SERVER['SERVER_NAME'];
> $self .= ($_SERVER['SERVER_PORT'] != '80') ? ':' .  
> $_SERVER['SERVER_PORT'] : '';
> $self .= $_SERVER['REQUEST_URI'];
> 
> ```
> 
> That should fix things for you. Naturally, on a real Apache running  
> by default in port 80, none of these shenanigans are required.
> 
> Walter
> 
> On Jul 3, 2009, at 11:33 AM, Todd wrote:
> 
> > The same thing happens.
> > 
> > I just noticed what must be the problem. I’m running MAMP and my  
> > local url is [http://localhost:8888/MAR/client/](http://localhost:8888/MAR/client/). But when the page  
> > tries to redirect back to itself the url shows as:  
> > [http://localhost/MAR/client/mar](http://localhost/MAR/client/mar).
> 
> * * *
> 
> dynamo mailing list  
> email@hidden  
> Update your subscriptions at:  
> [http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![waltd](https://discourse.softpress.com/user_avatar/discourse.softpress.com/waltd/32/2720_2.png) [@waltd](https://discourse.softpress.com/u/waltd)\
**Post date:** [July 3, 2009, 4:11pm UTC](https://discourse.softpress.com/t/mar-manage-result/5197/13 "2009-07-03T16:11:15Z")

</div>

I suspect it’s either being eaten somewhere, or you are trying to  
print $flash instead of $\_flash. See what happens if you put  
print\_r($\_SESSION) somewhere high up in your script, before any  
instance of anything that looks like `if(isset($_SESSION...`.

Remember, you are getting this value out of the session after a full  
redirect like this. The $flash (normal page variable) is for error  
messages (usually) because the page doesn’t get a full reload, it just  
fails through to the form, and the session is only populated after a  
full reload.

Walter

On Jul 3, 2009, at 12:00 PM, Todd wrote:

> That fixed the redirect error but the flash message doesn’t appear  
> now, the page reloads with no indication of the form being sent  
> (which it is). I quickly tried it on the live server without all the  
> hoop-jumping below and the result is the same, no errors but no  
> message either.
> 
> T.
> 
> On Jul 3, 2009, at 10:48 AM, Walter Lee Davis wrote:
> 
> > Easy. Just be more thorough about creating $self.
> > 
> > ```auto
> > $self = 'http://' . $_SERVER['SERVER_NAME'];
> > $self .= ($_SERVER['SERVER_PORT'] != '80') ? ':' .  
> > $_SERVER['SERVER_PORT'] : '';
> > $self .= $_SERVER['REQUEST_URI'];
> > 
> > ```
> > 
> > That should fix things for you. Naturally, on a real Apache running  
> > by default in port 80, none of these shenanigans are required.
> > 
> > Walter
> > 
> > On Jul 3, 2009, at 11:33 AM, Todd wrote:
> > 
> > > The same thing happens.
> > > 
> > > I just noticed what must be the problem. I’m running MAMP and my  
> > > local url is [http://localhost:8888/MAR/client/](http://localhost:8888/MAR/client/). But when the page  
> > > tries to redirect back to itself the url shows as:  
> > > [http://localhost/MAR/client/mar](http://localhost/MAR/client/mar).
> > 
> > * * *
> > 
> > dynamo mailing list  
> > email@hidden  
> > Update your subscriptions at:  
> > [http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)
> 
> * * *
> 
> dynamo mailing list  
> email@hidden  
> Update your subscriptions at:  
> [http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![Account](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/a/8baadc/32.png) [@Account](https://discourse.softpress.com/u/Account)\
**Post date:** [July 3, 2009, 4:47pm UTC](https://discourse.softpress.com/t/mar-manage-result/5197/14 "2009-07-03T16:47:52Z")

</div>

I assume you mean in the controller and when I do it throws an error.

T.

On Jul 3, 2009, at 11:11 AM, Walter Lee Davis wrote:

> I suspect it’s either being eaten somewhere, or you are trying to  
> print $flash instead of $\_flash. See what happens if you put  
> print\_r($\_SESSION) somewhere high up in your script, before any  
> instance of anything that looks like `if(isset($_SESSION...`.

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![waltd](https://discourse.softpress.com/user_avatar/discourse.softpress.com/waltd/32/2720_2.png) [@waltd](https://discourse.softpress.com/u/waltd)\
**Post date:** [July 3, 2009, 5:06pm UTC](https://discourse.softpress.com/t/mar-manage-result/5197/15 "2009-07-03T17:06:59Z")

</div>

Hmmm. I’m out of suggestions, then. Without seeing the error or the  
script running, it’s pretty hard to trace where the session is  
disappearing to.

Walter

On Jul 3, 2009, at 12:47 PM, Todd wrote:

> I assume you mean in the controller and when I do it throws an error.
> 
> T.
> 
> On Jul 3, 2009, at 11:11 AM, Walter Lee Davis wrote:
> 
> > I suspect it’s either being eaten somewhere, or you are trying to  
> > print $flash instead of $\_flash. See what happens if you put  
> > print\_r($\_SESSION) somewhere high up in your script, before any  
> > instance of anything that looks like `if(isset($_SESSION...`.
> 
> * * *
> 
> dynamo mailing list  
> email@hidden  
> Update your subscriptions at:  
> [http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![Account](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/a/8baadc/32.png) [@Account](https://discourse.softpress.com/u/Account)\
**Post date:** [July 3, 2009, 5:12pm UTC](https://discourse.softpress.com/t/mar-manage-result/5197/16 "2009-07-03T17:12:05Z")

</div>

I can put everything online or I can send you link to my local file(s)  
using Coda so you can see everything. Let me know what’s preferable.

T.

On Jul 3, 2009, at 12:06 PM, Walter Lee Davis wrote:

> Hmmm. I’m out of suggestions, then. Without seeing the error or the  
> script running, it’s pretty hard to trace where the session is  
> disappearing to.

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![waltd](https://discourse.softpress.com/user_avatar/discourse.softpress.com/waltd/32/2720_2.png) [@waltd](https://discourse.softpress.com/u/waltd)\
**Post date:** [July 3, 2009, 5:18pm UTC](https://discourse.softpress.com/t/mar-manage-result/5197/17 "2009-07-03T17:18:10Z")

</div>

Since you’re running this in MAMP, I don’t know what I could do from  
here unless we used Timbuktu or similar. Even if you posted it on a  
real server, you’d need to give me SSH privileges on that server so I  
could tweak things…

Pity Chicago and Philadelphia aren’t closer to one another…

Walter

On Jul 3, 2009, at 1:12 PM, Todd wrote:

> I can put everything online or I can send you link to my local  
> file(s) using Coda so you can see everything. Let me know what’s  
> preferable.
> 
> T.
> 
> On Jul 3, 2009, at 12:06 PM, Walter Lee Davis wrote:
> 
> > Hmmm. I’m out of suggestions, then. Without seeing the error or the  
> > script running, it’s pretty hard to trace where the session is  
> > disappearing to.
> 
> * * *
> 
> dynamo mailing list  
> email@hidden  
> Update your subscriptions at:  
> [http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![Account](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/a/8baadc/32.png) [@Account](https://discourse.softpress.com/u/Account)\
**Post date:** [July 3, 2009, 5:23pm UTC](https://discourse.softpress.com/t/mar-manage-result/5197/18 "2009-07-03T17:23:29Z")

</div>

Well, if I sent you the Coda link you could at least look at the file  
and see if I putzed something up. I could still run it on my end  
through MAMP to check it. As for giving you SSH priv. I’m willing to  
do that but I’m not sure how. I’ll have a look in my cp.

Todd

On Jul 3, 2009, at 12:18 PM, Walter Lee Davis wrote:

> Since you’re running this in MAMP, I don’t know what I could do from  
> here unless we used Timbuktu or similar. Even if you posted it on a  
> real server, you’d need to give me SSH privileges on that server so  
> I could tweak things…

* * *

dynamo mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)
