2016-05-17 8 views
-3

Es ist kein Problem von Leerraum.header location php (nicht Leerraum)

Ich habe dies in meiner Website:

Kann nicht modify header information - headers already von gesendet (Ausgabe gestartet unter C: \ xampp \ htdocs \ site \ Genera-certificato-arbo.php: 184) in C: \ xampp \ htdocs \ ssite \ Genera-certificato-arbo.php on line 403

<!doctype html> 

<html lang="it"> 

<head> 
    <meta charset="utf-8"> 

    <title>Gestionale avanzato Butterfly</title> 

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> 

    <link rel="stylesheet" type="text/css" href="style/macchinari.css"> 

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> 

    <script src="js/numscroller-1.0.js"></script> 


<style> 
table, th, td { 
    border: 1px solid #ddd; 
} 

td { 
padding: 5px; 
} 

textarea { 
    width: 545px; 
    height: 150px; 
    resize: vertical; 

} 

body { 
    counter-reset: mega-step; 
} 

.numeration { 
    counter-increment: mega-step; 
} 

.numeration:before { 
    content: counter(mega-step); 
} 


</style> 

    <!--[if lt IE 9]> 
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> 
    <![endif]--> 

</head> 

<body> 

<?php include 'include/top-menu.php'; ?> 

<?php include 'include/lateral-menu.php'; ?> 

<div class="super-content"> 

<?php 

$idarbo = $_GET["idarbo"]; 

$idarboprog = $_GET["idarboprog"]; 

?> 

<form action="genera-certificato-arbo.php?idarbo=<?php echo $idarbo; ?>&idarboprog=<?php echo $idarboprog; ?>&starter=1" method="POST"> 


<?php include 'connect.php'; ?> 


<div class="add-button">Aggiungi</div> 

<br> 

<div class="container-arbo"> 

<div class="numeration"></div>Specie <input type="text" name="specie[]"> 

<br><br> 

<table> 

<tr> 

<td colspan="2"> 

<input type="checkbox" name="palmetta[]" value="1"> Palmetta<br> 

<input type="checkbox" name="fusetto[]" value="1"> Fusetto<br> 

<input type="checkbox" name="vaso[]" value="1"> Vaso<br> 

</td> 

<td colspan="2"> 

<input type="checkbox" name="allevamento[]" value="1"> Allevamento 

<br> 
<br> 

<input type="checkbox" name="produzione[]" value="1"> Produzione 


</td> 

<td> 

Interfila m. <input type="text" name="interfila[]" size="5"> 

<br> 
<br> 

Altezza m. <input type="text" name="altezza[]" size="5"> 


</td> 

<td style="padding: 0px;"> 

<table style="border: 0px;"> 

<tr style="border: 0px;"><td style="border: 0px; text-align: center;" height="45" colspan="3">Densità</td></tr> 

<tr style="border: 0px;" height="40"> 


<td style="border-left: 0px; border-bottom: 0px;"><input style="vertical-align: top; display: none;" type="radio" name="dens[]" value="0" checked> 
<input style="vertical-align: top;" type="radio" name="dens[]" value="1"> A</td> 
<td style="border-bottom: 0px;"><input style="vertical-align: top;" type="radio" name="dens[]" value="2"> B</td> 
<td style="border-bottom: 0px;"><input style="vertical-align: top;" type="radio" name="dens[]" value="3"> C</td> 


</tr> 

</table> 

</td> 

</tr> 

<tr> 

<td>Marcia</td> 
<td>Giri motore</td> 
<td>Velocità (/km/h)</td> 
<td>Volume (l/ha)</td> 
<td>Ugelli chiusi</td> 
<td>Pressioni (bar)</td> 


</tr> 

<tr> 

<td><input style="width: 70px;" type="text" name="marcia[]" ></td> 
<td><input style="width: 70px;" type="text" name="giri[]"></td> 
<td><input style="width: 100px;" type="text" name="velocita[]"></td> 
<td><input style="width: 100px;" type="text" name="volume[]"></td> 
<td><input style="width: 145px;" type="text" name="ugelli[]"></td> 
<td><input style="width: 100px;" type="text" name="pressioni[]"></td> 

</tr> 

</table> 

<br> 

</div> 


<textarea rows="4" cols="50" name="prescrizioninote" placeholder="Prescrizioni e Note"></textarea> 

<br> 
<br> 
Data emissione:<br> 
<input type="date" value="<?php echo date('Y-m-d'); ?>" name="sday"> 
<br> 
<br> 
Data scadenza:<br> 
<input type="date" name="eday"> 
<br> 
<br> 

<input type="submit" value="Genera" class="btn btn-success"> 

</form> 

<?php 

if (isset($_GET["starter"])) { 

// Create connection 
$conn = new mysqli($servername, $username, $password, $dbname); 
// Check connection 
if ($conn->connect_error) { 
    die("Connection failed: " . $conn->connect_error); 
} 

$arr = array_values($_POST["dens"]); 

$sql = 'INSERT INTO cert_arbo (
idcertprog_arbo, 
specie_arbo, 
palmetta_arbo, 
fusetto_arbo, 
vaso_arbo, 
allevamento_arbo, 
produzione_arbo, 
interfila_arbo, 
altezza_arbo, 
densita_arbo, 
marcia_arbo, 
giri_motore_arbo, 
velocita_arbo, 
volume_arbo, 
ugelli_chiusi_arbo, 
pressione_arbo, 
specie_arbo2, 
palmetta_arbo2, 
fusetto_arbo2, 
vaso_arbo2, 
allevamento_arbo2, 
produzione_arbo2, 
interfila_arbo2, 
altezza_arbo2, 
densita_arbo2, 
marcia_arbo2, 
giri_motore_arbo2, 
velocita_arbo2, 
volume_arbo2, 
ugelli_chiusi_arbo2, 
pressione_arbo2, 
specie_arbo3, 
palmetta_arbo3, 
fusetto_arbo3, 
vaso_arbo3, 
allevamento_arbo3, 
produzione_arbo3, 
interfila_arbo3, 
altezza_arbo3, 
densita_arbo3, 
marcia_arbo3, 
giri_motore_arbo3, 
velocita_arbo3, 
volume_arbo3, 
ugelli_chiusi_arbo3, 
pressione_arbo3, 
specie_arbo4, 
palmetta_arbo4, 
fusetto_arbo4, 
vaso_arbo4, 
allevamento_arbo4, 
produzione_arbo4, 
interfila_arbo4, 
altezza_arbo4, 
densita_arbo4, 
marcia_arbo4, 
giri_motore_arbo4, 
velocita_arbo4, 
volume_arbo4, 
ugelli_chiusi_arbo4, 
pressione_arbo4, 
specie_arbo5, 
palmetta_arbo5, 
fusetto_arbo5, 
vaso_arbo5, 
allevamento_arbo5, 
produzione_arbo5, 
interfila_arbo5, 
altezza_arbo5, 
densita_arbo5, 
marcia_arbo5, 
giri_motore_arbo5, 
velocita_arbo5, 
volume_arbo5, 
ugelli_chiusi_arbo5, 
pressione_arbo5, 
specie_arbo6, 
palmetta_arbo6, 
fusetto_arbo6, 
vaso_arbo6, 
allevamento_arbo6, 
produzione_arbo6, 
interfila_arbo6, 
altezza_arbo6, 
densita_arbo6, 
marcia_arbo6, 
giri_motore_arbo6, 
velocita_arbo6, 
volume_arbo6, 
ugelli_chiusi_arbo6, 
pressione_arbo6, 
presc_note, 
data_emissione_arbo, 
data_scadenza_arbo) 
VALUES (
"'.$idarbo.'", 
"'.addslashes($_POST["specie"][0]).'", 
"'.addslashes($_POST["palmetta"][0]).'", 
"'.addslashes($_POST["fusetto"][0]).'", 
"'.addslashes($_POST["vaso"][0]).'", 
"'.addslashes($_POST["allevamento"][0]).'", 
"'.addslashes($_POST["produzione"][0]).'", 
"'.addslashes($_POST["interfila"][0]).'", 
"'.addslashes($_POST["altezza"][0]).'", 
"'.addslashes($arr[0]).'", 
"'.addslashes($_POST["marcia"][0]).'", 
"'.addslashes($_POST["giri"][0]).'", 
"'.addslashes($_POST["velocita"][0]).'", 
"'.addslashes($_POST["volume"][0]).'", 
"'.addslashes($_POST["ugelli"][0]).'", 
"'.addslashes($_POST["pressioni"][0]).'", 
"'.addslashes($_POST["specie"][1]).'", 
"'.addslashes($_POST["palmetta"][1]).'", 
"'.addslashes($_POST["fusetto"][1]).'", 
"'.addslashes($_POST["vaso"][1]).'", 
"'.addslashes($_POST["allevamento"][1]).'", 
"'.addslashes($_POST["produzione"][1]).'", 
"'.addslashes($_POST["interfila"][1]).'", 
"'.addslashes($_POST["altezza"][1]).'", 
"'.addslashes($arr[1]).'", 
"'.addslashes($_POST["marcia"][1]).'", 
"'.addslashes($_POST["giri"][1]).'", 
"'.addslashes($_POST["velocita"][1]).'", 
"'.addslashes($_POST["volume"][1]).'", 
"'.addslashes($_POST["ugelli"][1]).'", 
"'.addslashes($_POST["pressioni"][1]).'", 
"'.addslashes($_POST["specie"][2]).'", 
"'.addslashes($_POST["palmetta"][2]).'", 
"'.addslashes($_POST["fusetto"][2]).'", 
"'.addslashes($_POST["vaso"][2]).'", 
"'.addslashes($_POST["allevamento"][2]).'", 
"'.addslashes($_POST["produzione"][2]).'", 
"'.addslashes($_POST["interfila"][2]).'", 
"'.addslashes($_POST["altezza"][2]).'", 
"'.addslashes($arr[2]).'", 
"'.addslashes($_POST["marcia"][2]).'", 
"'.addslashes($_POST["giri"][2]).'", 
"'.addslashes($_POST["velocita"][2]).'", 
"'.addslashes($_POST["volume"][2]).'", 
"'.addslashes($_POST["ugelli"][2]).'", 
"'.addslashes($_POST["pressioni"][2]).'", 
"'.addslashes($_POST["specie"][3]).'", 
"'.addslashes($_POST["palmetta"][3]).'", 
"'.addslashes($_POST["fusetto"][3]).'", 
"'.addslashes($_POST["vaso"][3]).'", 
"'.addslashes($_POST["allevamento"][3]).'", 
"'.addslashes($_POST["produzione"][3]).'", 
"'.addslashes($_POST["interfila"][3]).'", 
"'.addslashes($_POST["altezza"][3]).'", 
"'.addslashes($arr[3]).'", 
"'.addslashes($_POST["marcia"][3]).'", 
"'.addslashes($_POST["giri"][3]).'", 
"'.addslashes($_POST["velocita"][3]).'", 
"'.addslashes($_POST["volume"][3]).'", 
"'.addslashes($_POST["ugelli"][3]).'", 
"'.addslashes($_POST["pressioni"][3]).'", 
"'.addslashes($_POST["specie"][4]).'", 
"'.addslashes($_POST["palmetta"][4]).'", 
"'.addslashes($_POST["fusetto"][4]).'", 
"'.addslashes($_POST["vaso"][4]).'", 
"'.addslashes($_POST["allevamento"][4]).'", 
"'.addslashes($_POST["produzione"][4]).'", 
"'.addslashes($_POST["interfila"][4]).'", 
"'.addslashes($_POST["altezza"][4]).'", 
"'.addslashes($arr[4]).'", 
"'.addslashes($_POST["marcia"][4]).'", 
"'.addslashes($_POST["giri"][4]).'", 
"'.addslashes($_POST["velocita"][4]).'", 
"'.addslashes($_POST["volume"][4]).'", 
"'.addslashes($_POST["ugelli"][4]).'", 
"'.addslashes($_POST["pressioni"][4]).'", 
"'.addslashes($_POST["specie"][5]).'", 
"'.addslashes($_POST["palmetta"][5]).'", 
"'.addslashes($_POST["fusetto"][5]).'", 
"'.addslashes($_POST["vaso"][5]).'", 
"'.addslashes($_POST["allevamento"][5]).'", 
"'.addslashes($_POST["produzione"][5]).'", 
"'.addslashes($_POST["interfila"][5]).'", 
"'.addslashes($_POST["altezza"][5]).'", 
"'.addslashes($arr[5]).'", 
"'.addslashes($_POST["marcia"][5]).'", 
"'.addslashes($_POST["giri"][5]).'", 
"'.addslashes($_POST["velocita"][5]).'", 
"'.addslashes($_POST["volume"][5]).'", 
"'.addslashes($_POST["ugelli"][5]).'", 
"'.addslashes($_POST["pressioni"][5]).'", 
"'.addslashes($_POST["prescrizioninote"]).'", 
"'.addslashes($_POST["sday"]).'", 
"'.addslashes($_POST["eday"]).'")'; 


if ($conn->query($sql) === TRUE) { 

    header('Location: http://localhost/bulzoni/avvio-download-arbo.php?idarboprog='.$idarboprog.'&idarbo='.$idarbo.''); 

} else { 

    echo "Error: " . $sql . "<br>" . $conn->error; 

} 

$conn->close(); 

}; 

?> 

</div> 

<script> 

$("input:radio").dblclick(function() { 

$(this).removeAttr("checked"); 

}); 


$(document).ready(function(){ 


    var maxField = 6; //Input fields increment limitation 

    var addButton = $('.add-button'); //Add button selector 

    var wrapper = $('.container-arbo'); //Input field wrapper 

    var a = 1; 

    var x = 1; //Initial field counter is 1 


    $(addButton).click(function(){ //Once add button is clicked 

    a++; 

    console.log(a); 


    var fieldHTML = '<div class="extra-table"><div class="remove">x</div><div class="numeration"></div>Specie <input type="text" name="specie[]"><br><br><table><tr><td colspan="2"><input type="checkbox" name="palmetta[]" value="1"> Palmetta<br><input type="checkbox" name="fusetto[]" value="1"> Fusetto<br><input type="checkbox" name="vaso[]" value="1"> Vaso<br></td><td colspan="2"> <input type="checkbox" name="allevamento[]" value="1"> Allevamento<br><br><input type="checkbox" name="produzione[]" value="1"> Produzione</td><td> Interfila m. <input type="text" name="interfila[]" size="5"><br><br>Altezza m. <input type="text" name="altezza[]" size="5"></td><td style="padding: 0px;"><table style="border: 0px;"><tr style="border: 0px;"><td style="border: 0px; text-align: center;" height="45" colspan="3">Densità</td></tr><tr style="border: 0px;" height="40"><td style="border-left: 0px; border-bottom: 0px;"><input style="vertical-align: top; display: none;" type="radio" name="dens[' + a + ']" value="0" checked><input style="vertical-align: top;" type="radio" name="dens[' + a + ']" value="1"> A</td><td style="border-bottom: 0px;"><input style="vertical-align: top;" type="radio" name="dens[' + a + ']" value="2"> B</td><td style="border-bottom: 0px;"><input style="vertical-align: top;" type="radio" name="dens[' + a + ']" value="3"> C</td></tr></table></td></tr><tr><td>Marcia</td><td>Giri motore</td><td>Velocità (/km/h)</td><td>Volume (l/ha)</td><td>Ugelli chiusi</td><td>Pressioni (bar)</td></tr><tr><td><input style="width: 70px;" type="text" name="marcia[]" ></td><td><input style="width: 70px;" type="text" name="giri[]"></td><td><input style="width: 100px;" type="text" name="velocita[]"></td><td><input style="width: 100px;" type="text" name="volume[]"></td><td><input style="width: 145px;" type="text" name="ugelli[]"></td><td><input style="width: 100px;" type="text" name="pressioni[]"></td></tr></table><br></div>'; 



    if(x < maxField){ //Check maximum number of input fields 

     x++; //Increment field counter 

     $(wrapper).append(fieldHTML); // Add field html 

    } 


    if(x === 3){ //Check maximum number of input fields 

    // $('.add-button').css("color", "#ccc"); 

    } else { 

    // $('.add-button').css("color", "blue"); 

    }; 

    }); 



    $(document).on('DOMNodeInserted', function(e) { 

    $('.remove_button').click(function(){ //Once add button is clicked 

    if(x < 4){ //Check maximum number of input fields 

    // $('.add-button').css("color", "blue"); 

    }; 

    }); 

    }); 



    $(wrapper).on('click', '.remove', function(e){ //Once remove button is clicked 

     e.preventDefault(); 

     $(this).closest(".extra-table").remove(); //Remove field html 

     x--; //Decrement field counter 
     a--; 

    }); 


}); 

</script> 

</body> 

</html> 

ich verbrachte Stunden für das Problem suchen, aber ich fand keine. Vielleicht könnte mir jemand helfen.

Diese Frage ist kein Duplikat, ich habe bereits die anderen Fragen gelesen. Aber sie haben mir nicht geholfen.

+0

nicht duplizieren, ich kann es nicht lösen konnte, habe ich schon gelesen. –

+2

@MaurizioBenini Wenn Sie gelesen hätten, sollten Sie behoben haben! Du druckst Zeichen vor 'header' Funktion – Thamilan

+2

Offensichtlich hast du es nicht gut genug gelesen, ** Es kann keine Ausgabe vor der Kopfzeile geben ** Es sei denn, du schaltest out/on output_buffering. – Epodax

Antwort

0

Was Sie brauchen, ist, Kopfzeile zu schreiben, bevor Sie Ihr HTML starten. Sie können die Datenbankbedingung von Anfang an überprüfen und die Seite umgehen. Da Sie bereits versuchen, basierend auf der Bedingung umzuleiten, warum sollten Sie es nicht auf die ersten paar Zeilen setzen und die Auslastung anderer Teile reduzieren?

Logisch Header werden zuerst gesendet und dann kommt Körper. In Ihrem Code ist die Mehrheit des Teils bereits so geladen, dass Ihr Puffer Daten des Headers im ersten Teil sendet. Wenn Sie also versuchen, den Header-Speicherort zu ändern, erhalten Sie einen solchen Fehler.

Schauen Sie sich unten Code,

<?php include 'connect.php'; 
if (isset($_GET["starter"])) { 
    // Create connection 
$conn = new mysqli($servername, $username, $password, $dbname); 
// Check connection 
if ($conn->connect_error) { 
    die("Connection failed: " . $conn->connect_error); 
} 
$arr = array_values($_POST["dens"]); 
$sql = 'INSERT INTO cert_arbo (
idcertprog_arbo, 
specie_arbo, 
palmetta_arbo, 
fusetto_arbo, 
vaso_arbo, 
allevamento_arbo, 
produzione_arbo, 
interfila_arbo, 
altezza_arbo, 
densita_arbo, 
marcia_arbo, 
giri_motore_arbo, 
velocita_arbo, 
volume_arbo, 
ugelli_chiusi_arbo, 
pressione_arbo, 
specie_arbo2, 
palmetta_arbo2, 
fusetto_arbo2, 
vaso_arbo2, 
allevamento_arbo2, 
produzione_arbo2, 
interfila_arbo2, 
altezza_arbo2, 
densita_arbo2, 
marcia_arbo2, 
giri_motore_arbo2, 
velocita_arbo2, 
volume_arbo2, 
ugelli_chiusi_arbo2, 
pressione_arbo2, 
specie_arbo3, 
palmetta_arbo3, 
fusetto_arbo3, 
vaso_arbo3, 
allevamento_arbo3, 
produzione_arbo3, 
interfila_arbo3, 
altezza_arbo3, 
densita_arbo3, 
marcia_arbo3, 
giri_motore_arbo3, 
velocita_arbo3, 
volume_arbo3, 
ugelli_chiusi_arbo3, 
pressione_arbo3, 
specie_arbo4, 
palmetta_arbo4, 
fusetto_arbo4, 
vaso_arbo4, 
allevamento_arbo4, 
produzione_arbo4, 
interfila_arbo4, 
altezza_arbo4, 
densita_arbo4, 
marcia_arbo4, 
giri_motore_arbo4, 
velocita_arbo4, 
volume_arbo4, 
ugelli_chiusi_arbo4, 
pressione_arbo4, 
specie_arbo5, 
palmetta_arbo5, 
fusetto_arbo5, 
vaso_arbo5, 
allevamento_arbo5, 
produzione_arbo5, 
interfila_arbo5, 
altezza_arbo5, 
densita_arbo5, 
marcia_arbo5, 
giri_motore_arbo5, 
velocita_arbo5, 
volume_arbo5, 
ugelli_chiusi_arbo5, 
pressione_arbo5, 
specie_arbo6, 
palmetta_arbo6, 
fusetto_arbo6, 
vaso_arbo6, 
allevamento_arbo6, 
produzione_arbo6, 
interfila_arbo6, 
altezza_arbo6, 
densita_arbo6, 
marcia_arbo6, 
giri_motore_arbo6, 
velocita_arbo6, 
volume_arbo6, 
ugelli_chiusi_arbo6, 
pressione_arbo6, 
presc_note, 
data_emissione_arbo, 
data_scadenza_arbo) 
VALUES (
"'.$idarbo.'", 
"'.addslashes($_POST["specie"][0]).'", 
"'.addslashes($_POST["palmetta"][0]).'", 
"'.addslashes($_POST["fusetto"][0]).'", 
"'.addslashes($_POST["vaso"][0]).'", 
"'.addslashes($_POST["allevamento"][0]).'", 
"'.addslashes($_POST["produzione"][0]).'", 
"'.addslashes($_POST["interfila"][0]).'", 
"'.addslashes($_POST["altezza"][0]).'", 
"'.addslashes($arr[0]).'", 
"'.addslashes($_POST["marcia"][0]).'", 
"'.addslashes($_POST["giri"][0]).'", 
"'.addslashes($_POST["velocita"][0]).'", 
"'.addslashes($_POST["volume"][0]).'", 
"'.addslashes($_POST["ugelli"][0]).'", 
"'.addslashes($_POST["pressioni"][0]).'", 
"'.addslashes($_POST["specie"][1]).'", 
"'.addslashes($_POST["palmetta"][1]).'", 
"'.addslashes($_POST["fusetto"][1]).'", 
"'.addslashes($_POST["vaso"][1]).'", 
"'.addslashes($_POST["allevamento"][1]).'", 
"'.addslashes($_POST["produzione"][1]).'", 
"'.addslashes($_POST["interfila"][1]).'", 
"'.addslashes($_POST["altezza"][1]).'", 
"'.addslashes($arr[1]).'", 
"'.addslashes($_POST["marcia"][1]).'", 
"'.addslashes($_POST["giri"][1]).'", 
"'.addslashes($_POST["velocita"][1]).'", 
"'.addslashes($_POST["volume"][1]).'", 
"'.addslashes($_POST["ugelli"][1]).'", 
"'.addslashes($_POST["pressioni"][1]).'", 
"'.addslashes($_POST["specie"][2]).'", 
"'.addslashes($_POST["palmetta"][2]).'", 
"'.addslashes($_POST["fusetto"][2]).'", 
"'.addslashes($_POST["vaso"][2]).'", 
"'.addslashes($_POST["allevamento"][2]).'", 
"'.addslashes($_POST["produzione"][2]).'", 
"'.addslashes($_POST["interfila"][2]).'", 
"'.addslashes($_POST["altezza"][2]).'", 
"'.addslashes($arr[2]).'", 
"'.addslashes($_POST["marcia"][2]).'", 
"'.addslashes($_POST["giri"][2]).'", 
"'.addslashes($_POST["velocita"][2]).'", 
"'.addslashes($_POST["volume"][2]).'", 
"'.addslashes($_POST["ugelli"][2]).'", 
"'.addslashes($_POST["pressioni"][2]).'", 
"'.addslashes($_POST["specie"][3]).'", 
"'.addslashes($_POST["palmetta"][3]).'", 
"'.addslashes($_POST["fusetto"][3]).'", 
"'.addslashes($_POST["vaso"][3]).'", 
"'.addslashes($_POST["allevamento"][3]).'", 
"'.addslashes($_POST["produzione"][3]).'", 
"'.addslashes($_POST["interfila"][3]).'", 
"'.addslashes($_POST["altezza"][3]).'", 
"'.addslashes($arr[3]).'", 
"'.addslashes($_POST["marcia"][3]).'", 
"'.addslashes($_POST["giri"][3]).'", 
"'.addslashes($_POST["velocita"][3]).'", 
"'.addslashes($_POST["volume"][3]).'", 
"'.addslashes($_POST["ugelli"][3]).'", 
"'.addslashes($_POST["pressioni"][3]).'", 
"'.addslashes($_POST["specie"][4]).'", 
"'.addslashes($_POST["palmetta"][4]).'", 
"'.addslashes($_POST["fusetto"][4]).'", 
"'.addslashes($_POST["vaso"][4]).'", 
"'.addslashes($_POST["allevamento"][4]).'", 
"'.addslashes($_POST["produzione"][4]).'", 
"'.addslashes($_POST["interfila"][4]).'", 
"'.addslashes($_POST["altezza"][4]).'", 
"'.addslashes($arr[4]).'", 
"'.addslashes($_POST["marcia"][4]).'", 
"'.addslashes($_POST["giri"][4]).'", 
"'.addslashes($_POST["velocita"][4]).'", 
"'.addslashes($_POST["volume"][4]).'", 
"'.addslashes($_POST["ugelli"][4]).'", 
"'.addslashes($_POST["pressioni"][4]).'", 
"'.addslashes($_POST["specie"][5]).'", 
"'.addslashes($_POST["palmetta"][5]).'", 
"'.addslashes($_POST["fusetto"][5]).'", 
"'.addslashes($_POST["vaso"][5]).'", 
"'.addslashes($_POST["allevamento"][5]).'", 
"'.addslashes($_POST["produzione"][5]).'", 
"'.addslashes($_POST["interfila"][5]).'", 
"'.addslashes($_POST["altezza"][5]).'", 
"'.addslashes($arr[5]).'", 
"'.addslashes($_POST["marcia"][5]).'", 
"'.addslashes($_POST["giri"][5]).'", 
"'.addslashes($_POST["velocita"][5]).'", 
"'.addslashes($_POST["volume"][5]).'", 
"'.addslashes($_POST["ugelli"][5]).'", 
"'.addslashes($_POST["pressioni"][5]).'", 
"'.addslashes($_POST["prescrizioninote"]).'", 
"'.addslashes($_POST["sday"]).'", 
"'.addslashes($_POST["eday"]).'")'; 
    if ($conn->query($sql) === TRUE) { 
     header('Location: http://localhost/bulzoni/avvio-download-arbo.php?idarboprog='.$idarboprog.'&idarbo='.$idarbo.''); 
     exit(); 
    } else { 
     echo "Error: " . $sql . "<br>" . $conn->error; 
    } 
    $conn->close(); 
}; 
?> 
<!doctype html> 
<html lang="it"> 
    <head> 
     <meta charset="utf-8"> 
     <title> 
      Gestionale avanzato Butterfly 
     </title> 
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> 
      <link rel="stylesheet" type="text/css" href="style/macchinari.css"> 
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> 
     <script src="js/numscroller-1.0.js"></script> 
     <style> 
      table, th, td { 
       border: 1px solid #ddd; 
      } 
      td { 
       padding: 5px; 
      } 
      textarea { 
       width: 545px; 
       height: 150px; 
       resize: vertical; 
      } 
      body { 
       counter-reset: mega-step; 
      } 
      .numeration { 
       counter-increment: mega-step; 
      } 
      .numeration:before { 
       content: counter(mega-step); 
      } 
     </style> 
     <!--[if lt IE 9]> 
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> 
<![endif]--> 
    </head> 
    <body> 
     <?php include 'include/top-menu.php'; ?> 
     <?php include 'include/lateral-menu.php'; ?> 
     <div class="super-content"> 
      <?php 
$idarbo = $_GET["idarbo"]; 
$idarboprog = $_GET["idarboprog"]; 
      ?> 
      <form action="genera-certificato-arbo.php?idarbo= 
<?php echo $idarbo; ?>&idarboprog= 
<?php echo $idarboprog; ?>&starter=1" method="POST"> 
       <div class="add-button"> 
        Aggiungi 
       </div> 
       <br> 
       <div class="container-arbo"> 
        <div class="numeration"> 
        </div> 
        Specie 
        <input type="text" name="specie[]"> 
        <br> 
        <br> 
        <table> 
         <tr> 
          <td colspan="2"> 
           <input type="checkbox" name="palmetta[]" value="1"> 
           Palmetta 
           <br> 
           <input type="checkbox" name="fusetto[]" value="1"> 
           Fusetto 
           <br> 
           <input type="checkbox" name="vaso[]" value="1"> 
           Vaso 
           <br> 
          </td> 
          <td colspan="2"> 
           <input type="checkbox" name="allevamento[]" value="1"> 
           Allevamento 
           <br> 
           <br> 
           <input type="checkbox" name="produzione[]" value="1"> 
           Produzione 
          </td> 
          <td> 
           Interfila m. 
           <input type="text" name="interfila[]" size="5"> 
           <br> 
           <br> 
           Altezza m. 
           <input type="text" name="altezza[]" size="5"> 
          </td> 
          <td style="padding: 0px;"> 
           <table style="border: 0px;"> 
            <tr style="border: 0px;"> 
             <td style="border: 0px; text-align: center;" height="45" colspan="3"> 
              Densità 
             </td> 
            </tr> 
            <tr style="border: 0px;" height="40"> 
             <td style="border-left: 0px; border-bottom: 0px;"> 
              <input style="vertical-align: top; display: none;" type="radio" name="dens[]" value="0" checked> 
              <input style="vertical-align: top;" type="radio" name="dens[]" value="1"> 
              A 
             </td> 
             <td style="border-bottom: 0px;"> 
              <input style="vertical-align: top;" type="radio" name="dens[]" value="2"> 
              B 
             </td> 
             <td style="border-bottom: 0px;"> 
              <input style="vertical-align: top;" type="radio" name="dens[]" value="3"> 
              C 
             </td> 
            </tr> 
           </table> 
          </td> 
         </tr> 
         <tr> 
         <td> 
          Marcia 
         </td> 
         <td> 
          Giri motore 
         </td> 
         <td> 
          Velocità (/km/h) 
         </td> 
         <td> 
          Volume (l/ha) 
         </td> 
         <td> 
          Ugelli chiusi 
         </td> 
         <td> 
          Pressioni (bar) 
         </td> 
        </tr> 
        <tr> 
         <td> 
          <input style="width: 70px;" type="text" name="marcia[]" > 
         </td> 
         <td> 
          <input style="width: 70px;" type="text" name="giri[]"> 
         </td> 
         <td> 
          <input style="width: 100px;" type="text" name="velocita[]"> 
         </td> 
         <td> 
          <input style="width: 100px;" type="text" name="volume[]"> 
         </td> 
         <td> 
          <input style="width: 145px;" type="text" name="ugelli[]"> 
         </td> 
         <td> 
          <input style="width: 100px;" type="text" name="pressioni[]"> 
         </td> 
        </tr> 
       </table> 
       <br> 
      </div> 
      <textarea rows="4" cols="50" name="prescrizioninote" placeholder="Prescrizioni e Note"></textarea> 
      <br> 
      <br> 
       Data emissione: 
       <br> 
       <input type="date" value="<?php echo date('Y-m-d'); ?>" name="sday"> 
       <br> 
       <br> 
       Data scadenza: 
       <br> 
       <input type="date" name="eday"> 
       <br> 
       <br> 
       <input type="submit" value="Genera" class="btn btn-success"> 
      </form> 
     </div> 
     <script> 
      $("input:radio").dblclick(function() { 
       $(this).removeAttr("checked"); 
      } 
            ); 
      $(document).ready(function(){ 
       var maxField = 6; 
       //Input fields increment limitation 
       var addButton = $('.add-button'); 
       //Add button selector 
       var wrapper = $('.container-arbo'); 
       //Input field wrapper 
       var a = 1; 
       var x = 1; 
       //Initial field counter is 1 
       $(addButton).click(function(){ 
        //Once add button is clicked 
        a++; 
        console.log(a); 
        var fieldHTML = '<div class="extra-table"><div class="remove">x</div><div class="numeration"></div>Specie <input type="text" name="specie[]"><br><br><table><tr><td colspan="2"><input type="checkbox" name="palmetta[]" value="1"> Palmetta<br><input type="checkbox" name="fusetto[]" value="1"> Fusetto<br><input type="checkbox" name="vaso[]" value="1"> Vaso<br></td><td colspan="2"> <input type="checkbox" name="allevamento[]" value="1"> Allevamento<br><br><input type="checkbox" name="produzione[]" value="1"> Produzione</td><td> Interfila m. <input type="text" name="interfila[]" size="5"><br><br>Altezza m. <input type="text" name="altezza[]" size="5"></td><td style="padding: 0px;"><table style="border: 0px;"><tr style="border: 0px;"><td style="border: 0px; text-align: center;" height="45" colspan="3">Densità</td></tr><tr style="border: 0px;" height="40"><td style="border-left: 0px; border-bottom: 0px;"><input style="vertical-align: top; display: none;" type="radio" name="dens[' + a + ']" value="0" checked><input style="vertical-align: top;" type="radio" name="dens[' + a + ']" value="1"> A</td><td style="border-bottom: 0px;"><input style="vertical-align: top;" type="radio" name="dens[' + a + ']" value="2"> B</td><td style="border-bottom: 0px;"><input style="vertical-align: top;" type="radio" name="dens[' + a + ']" value="3"> C</td></tr></table></td></tr><tr><td>Marcia</td><td>Giri motore</td><td>Velocità (/km/h)</td><td>Volume (l/ha)</td><td>Ugelli chiusi</td><td>Pressioni (bar)</td></tr><tr><td><input style="width: 70px;" type="text" name="marcia[]" ></td><td><input style="width: 70px;" type="text" name="giri[]"></td><td><input style="width: 100px;" type="text" name="velocita[]"></td><td><input style="width: 100px;" type="text" name="volume[]"></td><td><input style="width: 145px;" type="text" name="ugelli[]"></td><td><input style="width: 100px;" type="text" name="pressioni[]"></td></tr></table><br></div>'; 
        if(x < maxField){ 
         //Check maximum number of input fields 
         x++; 
         //Increment field counter 
         $(wrapper).append(fieldHTML); 
         // Add field html 
        } 
        if(x === 3){ 
         //Check maximum number of input fields 
         // $('.add-button').css("color", "#ccc"); 
        } 
        else { 
         // $('.add-button').css("color", "blue"); 
        }; 
       } 
           ); 
       $(document).on('DOMNodeInserted', function(e) { 
        $('.remove_button').click(function(){ 
         //Once add button is clicked 
         if(x < 4){ 
          //Check maximum number of input fields 
          // $('.add-button').css("color", "blue"); 
         }; 
        } 
              ); 
       } 
          ); 
       $(wrapper).on('click', '.remove', function(e){ 
        //Once remove button is clicked 
        e.preventDefault(); 
        $(this).closest(".extra-table").remove(); 
        //Remove field html 
        x--; 
        //Decrement field counter 
        a--; 
       } 
           ); 
       } 
           ); 
     </script> 
    </body> 
</html> 
+0

Vielen Dank für Ihre Antwort Kann ich ein kleines Beispiel erstellen, das mir hilft zu verstehen? Tut mir leid, aber ich habe es nicht erlebt, aber ich habe alles, was ich habe. –