Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Aggiungi/Rimuovi input text

    Ciao a tutti, (non capisco na mazza di PHP perciò chiedo help a voi master)

    ho questo codice

    codice:
    <html>
    
    	<head>
    
    	</head>
    
    
    		<body>
    
    <?php
    
    			echo("<table align =\"center\">");
    
    			echo("<tr>
    			<td>9) Debiti privati</td>
    			<td><input name=\"DebPriv\" type=\"text\" maxLength=\"10\" size=\"10\" class=\"importo\" onKeyUp=\"return controllaNumeri();\" onblur=\"somma(this.form)\" /></td>
    			
    
    			<td><input name=\"Commento 9)\" type=\"button\" value=\"*\" onClick=\"show_hide(this);\"></td>
    
    
    
    
    
    			<td><input name=\"Aggiungi_DP\" type=\"button\" value=\"Aggiungi\"><input name=\"Rimuovi_DP\" type=\"button\" value=\"Rimuovi\"></td>
    			
    
    			<td><input name=\"DebPrivCont\" type=\"text\" size=\"2\" value=\"".$_GET["DebPrivCont"]."\"></td>
    			</tr>");
    
    			echo("<tr>
    			<td></td>
    			<td>");
    
    
    
    for($x=0; $x<$_GET["DebPrivCont"]; $x++){
    echo("<input type=\"text\" size =\"2\" name=\"nDebPrivCont".$x."\" value=\"".$_GET["nDebPrivCont".$x]."\">");
    }
      
    for($y=0;$y<$_GET["DebPrivCont"];$y++){
    $valori[$y]=$_GET["nDebPrivCont".$y];
    }
    
    
    
    			echo("</td>
    			<td></td>
    			</tr>");
    
    ?>
    
    		</body>
    
    </html>
    io vorrei che cliccando il pulsante "Aggiungi_DP" mi inserisca il numero inserito nel campo "DebPrivCont"... sotto il campo di testo DebPriv... ad esempio se inserisco 5 mi deve inserire 5 campi di quel genere, si può fare? Dove sbaglio? (non riesco ad associare il bottone "Aggiungi" al ciclo... per non parlare del "Rimuovi") :master:

    Grazie

  2. #2
    Ho modificato un po'il codice nel modo seguente perché altrimenti non mi avrebbe aggiunto i campi come volevo (riga sotto riga)...

    codice:
    <html>
    
    	<head>
    
    	</head>
    
    
    		<body>
    
    <?php
    
    			echo("<table align =\"center\">");
    
    			echo("<tr>
    			<td>9) Debiti privati</td>
    			<td><input name=\"DebPriv\" type=\"text\" maxLength=\"10\" size=\"10\" class=\"importo\" onKeyUp=\"return controllaNumeri();\" onblur=\"somma(this.form)\" /></td>
    			
    
    			<td><input name=\"Commento 9)\" type=\"button\" value=\"*\" onClick=\"show_hide(this);\"></td>
    
    
    
    
    
    			<td><input name=\"Aggiungi_DP\" type=\"button\" value=\"Aggiungi\"><input name=\"Rimuovi_DP\" type=\"button\" value=\"Rimuovi\"></td>
    			
    
    			<td><input name=\"DebPrivCont\" type=\"text\" size=\"2\" value=\"".$_GET["DebPrivCont"]."\"></td>
    			</tr>");
    
    			
    
    
    
    for($x=0; $x<$_GET["DebPrivCont"]; $x++){
    echo("<tr>
    			<td></td>
    			<td><input type=\"text\" size =\"10\" name=\"nDebPrivCont".$x."\" value=\"".$_GET["nDebPrivCont".$x]."\"></td>
    			<td></td>
         </tr>");
    }
      
    for($y=0;$y<$_GET["DebPrivCont"];$y++){
    $valori[$y]=$_GET["nDebPrivCont".$y];
    }
    
    
    
    			echo("</td>
    			<td></td>
    			</tr>");
    
    ?>
    
    		</body>
    
    </html>
    qualcuno ha qualche suggerimento su come associare quei bottoni pf?

    Grazie

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.