-
- 8 Posts
Hi again & thanks for any help.
I really don’t know why I’m not getting this, but I’m slowly starting to understand modx better & better. My issue is now saving data to a database using formit.
What I do is I have a Resource which calls a chunk. The chunk has the following info at the top:
************************************************
[[!FormIt?
&hooks=`redirect`
&redirectTo=`53`
&store=`1`
]]
[[!FormItRetriever]]
<form action="[[~[[*id]]]]" method="POST" id="cityCouncilUpdate">
....
</form>
************************************************
When I submit this form it goes to another resource, which then calls the snippet which will need to save the data into the database. This is where I’m having an issue.
Is it possible to easily pass all fields that were submitted via POST to the new snippet so I can use it and save it to the database all in one step? I know if I put the [[+fi.field_name]] in a parameter of the snippet call that it will pass and I can save it, however I would rather use an array and pass everything. Some of these forms that I’m going to be submitting might have well over 100 fields on them and I don’t want to type all fields out on all pages.
I tried using the $_POST variable, but as expected that didn’t work.
Hopefully my question makes sense and someone can help me out.
Thanks again!
--
Dustin Miller
Cold Snap Technology
www.coldsnaptechnology.com
218-229-2887
-
- 8 Posts
Thanks for the response Whislemaker,
So, now I’m going to have to try that again. I had tried using the $_POST variable, but it kept coming up empty for whatever reason. When I get back to that project, I will give it a shot. If the $_POST variable actually does work, then things will go so much smoother for me.
It’s funny, usually I catch on to these things really quickly...but for some reason the way modx handles some of these things is just taking me a little longer than normal. If I was doing this from scratch, no problems...lol.
But I’m going to keep using modx, as I really like the potential of it, and it will eventually make all of my sites much easier to edit and update.
Thanks again,
Dustin
--
Dustin Miller
Cold Snap Technology
www.coldsnaptechnology.com
218-229-2887
-
- 387 Posts
don’t want to lead you astray -
I went back to work on the page to see if the new version of formit solved the problem I had (I had worked around it, and decided since everything was working to just leave it and not waste any more time).
Any way I noticed that if I used the formit &redirect=`whatever` $_POST did not work - if I just returned the results to same page as the form it did work, I think that if I used the standard <form action="foo.bar" it also worked (makes sense that it would.
Hope that helps.