Here I send you some code, first of all the javascript function:
Code: Select all
function addTel(number) {
totaltel = totaltel + number;
telfield = "";
if (number < 16 && number > -1) {
for (i=1; i <= number; i++) {
if (totaltel > 1) {telfield = telfield + "<br>"; }
telfield += "(" + "<? echo menuCaracTel("+ totaltel +",1); ?>" + ")";
telfield += "&nbsp;<input type='text' size='30' maxlength='70' name='telefono" + totaltel + "'>";
}
if (document.layers) {
document.layers.fieldtel.document.write(telfield);
document.layers.fieldtel.document.close();
}
else {
if (document.all) {
fieldtel.innerHTML += telfield;
}
}
}
else {
window.alert("Please select up to 15 entries.");
}
}Note 2: menuCaracTel() is a PHP functions that makes a dropdown menu with telephone prefixes. Also, names are in spanish.
After submit PHP should insert phones in tables here:
Code: Select all
$numtel = 1;
$tel = 'telefono'.$numtel;
while (isset($_POST[$tel])) {
$IDtelefono = nuevoId("IDtelefono","telefonos");
$tipo = 'T';
$carac = 'caractel'.$numtel;
$caracteristica = $_POST[$carac];
$numero = $_POST[$tel];
$descripcion = '';
$sql3 = "INSERT INTO telefonos VALUES ($IDtelefono,'$tipo',$caracteristica,$numero,$descripcion)";
mysql_query($sql3);
$sql4 = "INSERT INTO lista-telefonos VALUES ($IDcentro,$IDtelefono)";
mysql_query($sql4);
$numtel++;
$tel = 'telefono'.$numtel;
}I wish you can help me, I think the problem is that the inputs are seen but not passed through $_POST data, probably I should make this in another way, don´t know. Thank you very much.