Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. $comentarios = $_POST;
  5.  
  6. echo "<form method='post' action='#'>";
  7.  
  8. $nr_comentarios = count($_POST)-1;
  9.  
  10. for ($i = 0; $i < $nr_comentarios; $i++) {
  11. echo "<input type='text' name='$i' class='form-control' value='$comentarios[$i]'><br>";
  12. };
  13.  
  14. if(isset($_POST['new'])){
  15. if($_POST['new'] != ''){
  16. echo "<input type='text' name='$nr_comentarios' class='form-control' value=".$comentarios['new']."><br>";
  17. }
  18. }
  19. echo "<input type='text' name='new' class='form-control'><br>";
  20. echo "<button type='submit' class='btn btn-default'>Enviar</button>
  21. </form>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement