<...">

Make a function to create an auto-input box

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title>ssc prepartion</title>
  </head>

  <body><form action="ssc.php" method="post">
    1
    <input name="name" type="text">
    <input name="submit" type="submit"value="result"></form>
  </body>
</html>

      

// creating php file to get the result.
<?php
   $name=$_REQUEST["name"];

   $text="user".$name;
   echo'<form action="ssc1.php" method="post">';
   for($x =0; $x <= $name; $x++) {
    echo '<label for="'. $name .'">'.$x.'</label>';
      echo '<input type="text" name="'.$text.'" ><br><br>';
   }

   echo'<input type="submit" value="result">';
   echo'</form>';
?>

      

So here I am trying to create input fields by creating a small PHP function. It works and creates input fields, but the problem is creating these input fields.

I cannot figure out how to provide a name or ID for these input fields and how to get the values ​​from all the generated fields.

My question is, how can we get values ​​from these input fields after creating all of these?

+3


source to share


1 answer


using php, in ssc1.php page you can get input values ​​with $ _POST ['Name of input']



0


source







All Articles