Passing PHP variable to Javascript dynammically added textbox
<p>i have a javascript function like this:</p>

<pre><code>function addfamily(divName){
    var newdiv = document.createElement('div');
    newdiv.innerHTML = '&lt;input type="text" name="family[]" size="16"&gt;';
    document.getElementById(divName).appendChild(newdiv);
}
</code></pre>

<p>which dynamically adds textbox to the form and a php script like this:</p>

<pre><code>&lt;?php
$result_family = mysql_query("SELECT * FROM family_member where login_id='$_SESSION[id]'");

$num_rows_family = mysql_num_rows($result_family);

if ($num_rows_family&gt;0) {

   while($row_family = mysql_fetch_assoc($result_family)){

   echo "&lt;script language=javascript&gt;addfamily('family');&lt;/script&gt;";
   }
}
</code></pre>

<p>having this code the textboxes are added fine.
i just need to know how can i set a dynamic value as the textbox value by passing the php variable <code>$row_family[name]</code> to the function and the value of the textbox???
please help</p>
