0

I need to display 1 single form on a website where the user can type a number and hit the button "create" , if he input the number 2 , a new form with 2 fields will be created , if he adds number 10 then 10 text fields will be created.

I've created a code using php and html but I0m getting an error saying "Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\Forms\Examen 1\Formulario Dinamico.php on line 28" and the information on that line is "< /html>"

<html lang="es">
<head>
<meta charset="utf-8">
<title>Dynamic form
</title>
</head>

<body>

<form action="#" method="POST">
<input type="text" name="quantity" placeholder="Add quantity">
<Input type="submit" name="btnCreate" value="create">
</form>

<?php
if(isset($_REQUEST['btnCreate']))
{
$cantidad=$_REQUEST['quantity'];

for($i=0;$i<=$cantidad;$i++)
{ ?>
<form action="#" method="POST">
<input type="text" name="Name[<?= $i ?>]">
</form>
<?php}}

</body>
</html>

Help , what am I missing?

Samayoa
  • 185
  • 1
  • 2
  • 12

0 Answers0