CodeIgniter Forums
Show all posted data - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Show all posted data (/showthread.php?tid=3388)



Show all posted data - El Forum - 09-27-2007

[eluser]Lobosaurus[/eluser]
Hello,

how can I display all data in $_POST using $this->input->post(). My form is a part of quiz system where names attributes are question id´s and values are answer id´s and I don´t know exactly which will be randomly selected to use $this->input->post('variable').


Show all posted data - El Forum - 09-27-2007

[eluser]Référencement Google[/eluser]
No sure this will work, and not really understood what's your need but you can try to put in your form as name an array name="value[]"

Then in your controller loop on $_POST['value']

Maybe could you put some code here?


Show all posted data - El Forum - 09-27-2007

[eluser]Lobosaurus[/eluser]
I would like to use CI´s Input class syntax to show all posted data and make some actions and then loop it.

I use for example this code to remove the last value in $_POST array (usually a submit button):

Code:
$last = array_pop($_POST);
print_r($_POST);

I suppose that $_POST array and $this->input->post() are sanitized in different ways and may differ in the future.


Show all posted data - El Forum - 09-27-2007

[eluser]charlieD[/eluser]
I guess you could try this:

Code:
echo '<ul>';
foreach ($_POST as $key=>$value)
{
    $cleanVal = $this->input->post($key);
    echo "<li>$key = $cleanVal</li>";
}
echo '</ul>';