<form>
no of textboxes needed to generate dynamically<input type="text" name="tboxes" size="50">
<input type="Submit" name="Submit" value="Submit">
</form>
<?php
$tboxes=$_REQUEST['tboxes'];

for ($i=1;$i<=$tboxes;$i++)
{  
 print "<input type='text' name=txt$i>";
}
 print "<input type='submit' name='submit' value='submit'>";
?>

please do tell me how to get the values entered in a textboxes,i want to know whether i can use array .....if so then please do tell me

Well you don't really need to use PHP for that, that is some very simple JavaScript

function addBoxes(numBoxes, parent)
{
   for(i=0;i<numBoxes;i++)
   {
      $tmpbox = document.createElement('input');
      $tmpbox.type = "text";
      $tmpbox.id = "txt"+i;
      parent.appendChild($tmpBox);
   }
}

Then in the page just put

<form>
no of textboxes needed to generate dynamically
<input type="text" id="numboxes" name="tboxes" size="50">
<input type="button" name="create" value="Create Inputs" 
    onclick="addBoxes(document.getElementById('numboxes').value, this.parentNode);">
</form>

ya tat helped me in generating textboxes with different name but how to get the values from the textboxes which is generated

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.