ho una pagina php dove al suo interno ho una tabella (all'interno di una form) a cui voglio sia possivile aggiungerci una riga contentenente in ordine
textbox--textbox--combobox--textbox--textarea--2radiobutton
la combobox dovrebbe prendere i suoi "value" e i suoi testi da una tabella dei comuni.
qualcuno mi puo dire come fare??
p.s. ho gia eventualmente se puo servire la stringa in html che mi permette di creare la combobox
posto di seguito un pesso della funzione
qui invece la funzione inizializecodice://alert('sono entrato in '+id); var td5 = document.createElement("TD"); td5.appendChild(document.createElement("<input type='text' name='prezzo_base"+(i+1)+"'>")); //alert('td5'); var td6 = document.createElement("TD"); td6.appendChild (document.createElement("<input type='text' name='rilancio"+(i+1)+"'>")); //alert('td6'); var td7 = document.createElement("TD"); td7.appendChild (document.createElement("<select name='comune"+(i+1)+"'>")); //alert('td7'); var td8 = document.createElement("TD");//problema td8.appendChild (document.createElement("<input type='text' name='indirizzo_lotto"+(i+1)+"'>")); //alert('td8'); var td4 = document.createElement("TD"); td4.appendChild(document.createElement("<textarea type='text' name='descrizione"+(i+1)+"' cols=40 rows=3></textarea>")); alert('td4'); var td9 = document.createElement("TD");//problema td9.appendChild(document.createElement("<input name='vendita_lotto"+(i+1)+"' type='radio' value='0' checked/>")); td9.appendChild(document.createElement("<input name='vendita_lotto"+(i+1)+"' type='radio' value='1' />")); alert('td9'); var td0 = document.createElement("TD"); td0.appendChild(document.createElement("<input type='hidden' name='id_lotto"+(i+1)+"'>")); alert('quasi finito?'); row2.appendChild(td5); row2.appendChild(td6); row2.appendChild(td7); row2.appendChild(td8); row2.appendChild(td4); row2.appendChild(td9); row2.appendChild(td0); body.appendChild(row2);
e infine la chiamata dal phpcodice:function inizialize_comune(comune){ alert('riuscito'); combo=comune; }
codice://creazione combo dei comuni $combocomune="<option value=\"0\">Nessuno</option>"; $sql="SELECT * FROM comune ORDER by comune LIMIT 3;"; $result=mysql_query($sql); while ($row=mysql_fetch_array($result)){ $combocomune= $combocomune . "<option value=\"$row[cap]\" type=\"submit\"> $row[comune]</option>"; } $combocomune=$combocomune . "</select>"; echo "<script language=\"javascript\"> inizialize_comune('".str_replace("\"","\'",$combocomune) . "')</script>";

Rispondi quotando