CodeIgniter Forums
submit on a form - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: submit on a form (/showthread.php?tid=78088)



submit on a form - richb201 - 11-27-2020

I have an email that I am sending to users. In it a user clicks on a link which brings them to http://localhost/index.php/Configure/MyFormEmployee which is a function in my controller that displays a survey.  They fill out the form and hit "submit" which brings them to http://localhost/index.php/Configure/survey_results which is another function in my controller. In survey_results() I will total up the survey and write the results to a mysql table. Ignore the "localhost" implications since that is just for testing. 

But what happens if the user of the CI application is no longer running the application? Since this survey invitation is sent via email and the receiver has 48 hours to fill out a survey there is a very good chance that they will no longer be running the application. Will the survey results function still run? 


RE: submit on a form - sammyskills - 11-27-2020

Quote:But what happens if the user of the CI application is no longer running the application?

Can you expatiate on this?


RE: submit on a form - richb201 - 11-27-2020

Yeah. The user of the CI application is using it to set up a entire campaign. One of the things they can do is send survey's to users via email. The user has 48 hours to fill out a survey. After that they will no longer be able to access the survey. This is controlled by the authentication application I am using and is running independently of CI.

The concern is that in the _init I am setting up the databases. The survey "filler" is not entering through the "proper door".


RE: submit on a form - sammyskills - 11-27-2020

Sorry, still not clear to me.

I understand that you are setting up the databases in the _init. I assume that the survey "filler" is a function that submits the survey, but it is not entering through CI..am I correct?

If this is correct, that brings me back to your initial question:
Quote:Will the survey results function still run?

Yes, in my opinion, since it is controlled by the authentication application running independently of CI.


RE: submit on a form - richb201 - 11-27-2020

OK. Thanks, I just tested it and I think it is going to work. Since the person filling out the form is not going through as regular login sequence, I need to send in some identifying information with the POST on the form. How can I send in a string via the form's POST?


RE: submit on a form - sammyskills - 11-27-2020

Well, you can save the person's email address in a hidden input field.

The value of the input field would be populated from the url that was sent to the person's email address. For example,

Code:
http://localhost/CI/[email protected]

So, when the user clicks on the link from his/her email address, it redirects to the survey form where you can easily populate the hidden input field with the $_GET['user-email'] superglobal.

I assume you already apply urlencode() and other security functions to the link before sending to the user(s).


RE: submit on a form - InsiteFX - 11-28-2020

Or you can set the values in the session using the session helper method.

PHP Code:
$data = [
    'key' => 'value',
];

// the session helper is chainable.
session()->set($data); 



RE: submit on a form - richb201 - 11-28-2020

Thanks guys, I got this response from the Koolreport support team which I am going to try:

You may use the hidden input inside the form

<input name="hidden_email" value="[email protected]" />
You will receive this at server $_POST["hidden_email"]

The rest of the form is being build with Koolreport tools (Amazing Lib).