(PHP/JQuery) Populating form with data?
<pre><code>populate_form($array_data)
{
   //Format: $array_data['css_selector'] = "value";

    $html = "&lt;script&gt;\n$(document).ready(function(){\n";

    foreach($array_data as $key =&gt; $val)
    {
        $html .= "$('$key').val('$val');\n";
    }

    $html .= "});\n&lt;/script&gt;";

    return $html;
}
</code></pre>

<p>I just coded this function but havent used it yet. 
I wonder if this is approach for populating form with data is a good idea.</p>
