Welcome Guest, Not a member yet? Register   Sign In
submit on a form
#1

(This post was last modified: 11-27-2020, 07:04 AM by richb201.)

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? 
proof that an old dog can learn new tricks
Reply
#2

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

Can you expatiate on this?
Reply
#3

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".
proof that an old dog can learn new tricks
Reply
#4

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.
Reply
#5

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?
proof that an old dog can learn new tricks
Reply
#6

(This post was last modified: 11-27-2020, 08:40 AM by sammyskills.)

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).
Reply
#7

(This post was last modified: 11-28-2020, 12:57 AM by InsiteFX.)

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); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#8

(This post was last modified: 11-28-2020, 05:26 AM by richb201.)

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).
proof that an old dog can learn new tricks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB