error on form posting in firefox
file name : addelements.php
function addChar()
{
var tr1 = document.createElement('TR');
var tr2 = document.createElement('TR');
var tr3 = document.createElement('TR');
var td1 = document.createElement('TD');
var td2 = document.createElement('TD');
var td3 = document.createElement('TD');
var td4 = document.createElement('TD');
var br = document.createElement('BR');
var value_el = document.createElement('input');
value_el.setAttribute('type','text');
value_el.setAttribute('name','value_el[]');
value_el.setAttribute('size','10');
value_text = document.createTextNode("value(el)");
td1.appendChild(value_text);
//td1.innerHTML += "value (gr)";
td1.appendChild(value_el);
td1.setAttribute('class',"what");
td1.setAttribute("className", "what");
var value_en = document.createElement('input');
value_en.setAttribute('type','text');
value_en.setAttribute('name','value_en[]');
value_en.setAttribute('size','10');
value_text2 = document.createTextNode("value(en)");
//td2.innerHTML += "value (en)";
td2.appendChild(value_text2);
td2.appendChild(value_en);
td2.setAttribute('class', 'what2');
td2.setAttribute('className', 'what2');
tr1.appendChild(td1);
tr1.appendChild(td2);
var unit_el = document.createElement('input');
unit_el.setAttribute('type','text');
unit_el.setAttribute('name','unit_el[]');
unit_el.setAttribute('size','10');
unit_text = document.createTextNode("unit(el)");
td4.appendChild(unit_text);
//td4.innerHTML += "unit (el)";
td4.appendChild(unit_el);
td4.setAttribute('class', 'what2');
td4.setAttribute('className', 'what2');
var unit_en = document.createElement('input');
unit_en.setAttribute('type','text');
unit_en.setAttribute('name','unit_en[]');
unit_en.setAttribute('size','10');
//td3.innerHTML += "Μονάδα (en)";
unit_text2 = document.createTextNode("unit(en)");
td3.appendChild(unit_text2);
td3.appendChild(unit_en);
td3.setAttribute('class', 'what');
td3.setAttribute('className', 'what');
tr2.appendChild(td3);
tr2.appendChild(td4);
var td4 = document.createElement('TD');
var td5 = document.createElement('TD');
td4.setAttribute("colspan", "2");
var table = document.createElement('TABLE');
var name = document.createElement("select");
name.setAttribute("name", "name[]");
EOF;
$sql = "SELECT char_id, char_name_el, char_name_en FROM characteristic ORDER BY order1";
$res_sql = mysql_query($sql) or die(mysql_error());
//$results = process_sql($sql);
$i=0;
while($row = mysql_fetch_array($res_sql))
{
echo "var option_".$i." = document.createElement(\"option\");";
echo "option_".$i.".setAttribute(\"value\", \"".$row[0]."\");";
echo "var option_txt_".$i." = document.createTextNode(\"".$row[1]."\");";
echo "option_".$i.".appendChild(option_txt_".$i.");";
echo "name.appendChild(option_".$i.");";
$i++;
}
echo <<<EOF
td4.appendChild(name);
tr3.appendChild(td4);
document.getElementById('char').appendChild(tr3);
document.getElementById('char').appendChild(tr1);
document.getElementById('char').appendChild(tr2);
}
the above code is used in a php application!
filename : add_product.php
<form name="new_product" enctype="multipart/form-data" method="POST" id="product">
<table>
<tr>
<td colspan="2">
<table cellpadding="1" cellspacing="1" width="60%">
<tbody id="char">
</tbody>
</table>
<a href="javascript:addChar()">add elements</a>
</td>
</tr>
<form>
</table>

