0
votes

I want to build a simple app (at least for now), which helps me with creating a lot of similar HTML templates.

I created main page with form, in which I put those text data, which changes; the rest should my Symfony app generate for me.

I wondered for a while how to do this, and found following solution: 1. On main page with form I POST form-from-data to self (same webpage). 2. In action of the main page I check if all the INPUTs are fulfilled (if no, app escapes from if statement and show the same main page with the same form). 3. if yes, I want to show just my HTML template through htmlspecialchars() function. Symfony remembers the result in $templ_cont.

And this last part is the problem.

I'm re-directing (with header('Location: .... " ) to another action in the same module, called "templ". It works, but new action (templ) doesn't remember my $templ_cont, it just shows its template.

How can I make variable visible for two actions in the same module (thus, in the same PHP file as well, but in different functions), avoiding 'ugly' solutions?

Thanks in advance.

1
Is there a reason to use redirect, and not to use ->forward() instead? - Maxim Krizhanovsky

1 Answers

0
votes