Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter Clearing $_POST Data - What Should I Do?
#1

[eluser]Unknown[/eluser]
Hi,

I have written a web app that pulls displays a quiz.

I echo out the multiple choice options in a view ("quiz"). Each question is dynamic and has a different correct answer each time.

When a user clicks to go to the "results" controller and subsequent view I'd like to present the results. For this I need some way of passing the true answer to the controller. I cannot do this through the form values as that would give away the answer in the source.

I access some other question information in the mark controller using the information posted from the form. However, if I try to secretly pass the correct answer back using PHP then when I try and access and print it out it is empty???

Code:
$_POST['answer1'] = "dog";
This is what I use to set the $_POST in PHP can anyone tell me how I can set the data without it being cleaned out (by CI I assume) or another easy way of doing this (no sessions, cookies please) with $_POST data?

Thank you!
#2

[eluser]TWP Marketing[/eluser]
pass the 'true' answers to the form view and return them using hidden type form fields.
They will not be visible in the source but you may retrieve them using either $_POST or CI's helper $this->input->post('var_name');




Theme © iAndrew 2016 - Forum software by © MyBB