Buy Now
Sign in

Best way to display a report AND add to database?

sinemac , October 30 2007, 04:15
S
sinemac 52
October 30 2007, 04:15 #3199
I've used ChronoForms to create a form that collects some assessment data. Upon submit, I'd like the data to be added to the database AND have a report based on that data displayed. I'm not sure the best way to do this.

Currently, I have the php code for creating and displaying the report in an external php file that I call in an article using using the rdaddphp plugin. It works great - the data is passed to the script and the report is displayed just how I want it - BUT to get it to work, I set it to go to the script "on submit", so the data isn't saved to the database.

It seems to me there could be a few ways to go:
    [*]keep the external script as "on submit" and put code in the script to add the data to the database[/*]
    [*]change the external script to be a "redirect" after submit, and add code to pull the just submitted data from the database (I already tried it without, but it seems the $_POST variables are lost by the time the redirect happens, as the report comes out empty[/*]
    [*]some other way?
    [list][*]is there code that could do it in the "before sending email" area?[/*]
    [*]or the after sending email section?[/*]
    [*]or the javascript section?
    [/*]
[/*][/list]

In addition to not know which way would be best, I'm not sure how to go about doing any of them, as I don't know javascript, or how to access the database after submission, and be sure it gets the correct record.

Suggestions?

Thanks,
Scott

Post edited by: sinemac, at: 2007/10/30 00:16<br><br>Post edited by: sinemac, at: 2007/10/30 00:18
S
sinemac 52
October 30 2007, 04:20 #3200
It occurs to me it might be easier to follow with an example:
http://www.headgutcheck.com/score_your_session
admin 27
October 31 2007, 00:34 #3231
Hi sinemac,

I agree, form data will need to be resubmitted someway, please google for fsockopen or curl, those are the methods I know which can help resubmitting the data to another URL, I wish you will do it

Sincerely,

Max
Max
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
S
sinemac 52
October 31 2007, 00:53 #3233
Thanks, Max. I'll see what I can discover, and will report back.