Welcome Guest, Not a member yet? Register   Sign In
Displaying dynamic form data
#3

[eluser]Chris Williams[/eluser]
Right. I wasn't sure if there was a helper built in for this or not. Basically, my database populates the form which changes week to week. So I can't hard code any of it.

I am using this for dynamically made forms. It works, I didn't know if there was a smarter way around this.

Code:
foreach ($_POST as $i => $someVar)
{    
    if ($someVar != 0){
        $query = $this->db->query("SELECT name, id FROM mytable WHERE id = $i");
        foreach ($query->result() as $row)
        {
           $body .= $row->name . " x " . $someVar . "<br />";
        }
    }    
}
$data['body'] = $body;


Messages In This Thread
Displaying dynamic form data - by El Forum - 07-07-2007, 12:36 PM
Displaying dynamic form data - by El Forum - 07-07-2007, 04:11 PM
Displaying dynamic form data - by El Forum - 07-08-2007, 10:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB